X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.scl.reflection%2Fsrc%2Forg%2Fsimantics%2Fscl%2Freflection%2Ffunctions%2FInstanceMethodFunction.java;h=2899473b085e734ed924710839337ac3d67ab886;hb=refs%2Fchanges%2F38%2F238%2F2;hp=94294d53e648b157610324adbc669889f2e0eda9;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.scl.reflection/src/org/simantics/scl/reflection/functions/InstanceMethodFunction.java b/bundles/org.simantics.scl.reflection/src/org/simantics/scl/reflection/functions/InstanceMethodFunction.java old mode 100755 new mode 100644 index 94294d53e..2899473b0 --- a/bundles/org.simantics.scl.reflection/src/org/simantics/scl/reflection/functions/InstanceMethodFunction.java +++ b/bundles/org.simantics.scl.reflection/src/org/simantics/scl/reflection/functions/InstanceMethodFunction.java @@ -1,38 +1,38 @@ -package org.simantics.scl.reflection.functions; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.Arrays; - -import org.simantics.scl.runtime.function.FunctionImplN; - -public class InstanceMethodFunction extends FunctionImplN { - Method method; - - public InstanceMethodFunction(Method method) { - super(method.getParameterTypes().length+1); - this.method = method; - } - - public Method getMethod() { - return method; - } - - @Override - public Object doApply(Object... ps) { - try { - return method.invoke(ps[0], Arrays.copyOfRange(ps, 1, ps.length)); - } catch (IllegalArgumentException e) { - throw new RuntimeException(e); - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } catch (InvocationTargetException e) { - throw new RuntimeException(e); - } - } - - @Override - public String toString() { - return method.getName(); - } -} +package org.simantics.scl.reflection.functions; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Arrays; + +import org.simantics.scl.runtime.function.FunctionImplN; + +public class InstanceMethodFunction extends FunctionImplN { + Method method; + + public InstanceMethodFunction(Method method) { + super(method.getParameterTypes().length+1); + this.method = method; + } + + public Method getMethod() { + return method; + } + + @Override + public Object doApply(Object... ps) { + try { + return method.invoke(ps[0], Arrays.copyOfRange(ps, 1, ps.length)); + } 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 method.getName(); + } +}