X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.scl.reflection%2Fsrc%2Forg%2Fsimantics%2Fscl%2Freflection%2Ffunctions%2FInstanceMethodFunction.java;fp=bundles%2Forg.simantics.scl.reflection%2Fsrc%2Forg%2Fsimantics%2Fscl%2Freflection%2Ffunctions%2FInstanceMethodFunction.java;h=2899473b085e734ed924710839337ac3d67ab886;hp=fa729ea7acff4b16deb99a44ae45888448dd6729;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 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 fa729ea7a..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.getCause()); - } - } - - @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(); + } +}