X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.scl.reflection%2Fsrc%2Forg%2Fsimantics%2Fscl%2Freflection%2Ffunctions%2FConstructorFunction.java;h=2a8d006af30e9361a41ea59539878f01bad52724;hb=refs%2Fchanges%2F38%2F238%2F2;hp=7bd3b008c8bbc8657bd2d6073a25125ec98af633;hpb=b35573372259ace60d8827766fe41443f4c57629;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.scl.reflection/src/org/simantics/scl/reflection/functions/ConstructorFunction.java b/bundles/org.simantics.scl.reflection/src/org/simantics/scl/reflection/functions/ConstructorFunction.java old mode 100755 new mode 100644 index 7bd3b008c..2a8d006af --- a/bundles/org.simantics.scl.reflection/src/org/simantics/scl/reflection/functions/ConstructorFunction.java +++ b/bundles/org.simantics.scl.reflection/src/org/simantics/scl/reflection/functions/ConstructorFunction.java @@ -1,39 +1,39 @@ -package org.simantics.scl.reflection.functions; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; - -import org.simantics.scl.runtime.function.FunctionImplN; - -public class ConstructorFunction extends FunctionImplN { - Constructor constructor; - - public ConstructorFunction(Constructor constructor) { - super(constructor.getParameterTypes().length); - this.constructor = constructor; - } - - public Constructor getConstructor() { - return constructor; - } - - @Override - public Object doApply(Object... ps) { - try { - return constructor.newInstance(ps); - } catch (InstantiationException e) { - throw new RuntimeException(e); - } catch (IllegalArgumentException e) { - throw new RuntimeException(e); - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } catch (InvocationTargetException e) { - throw new RuntimeException(e.getCause()); - } - } - - @Override - public String toString() { - return constructor.getName(); - } -} +package org.simantics.scl.reflection.functions; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; + +import org.simantics.scl.runtime.function.FunctionImplN; + +public class ConstructorFunction extends FunctionImplN { + Constructor constructor; + + public ConstructorFunction(Constructor constructor) { + super(constructor.getParameterTypes().length); + this.constructor = constructor; + } + + public Constructor getConstructor() { + return constructor; + } + + @Override + public Object doApply(Object... ps) { + try { + return constructor.newInstance(ps); + } catch (InstantiationException e) { + throw new RuntimeException(e); + } catch (IllegalArgumentException e) { + throw new RuntimeException(e); + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } catch (InvocationTargetException e) { + throw new RuntimeException(e.getCause()); + } + } + + @Override + public String toString() { + return constructor.getName(); + } +}