1 package org.simantics.scl.reflection.functions;
\r
3 import java.lang.reflect.InvocationTargetException;
\r
4 import java.lang.reflect.Method;
\r
6 import org.simantics.scl.runtime.function.FunctionImplN;
\r
8 public class ClassMethodFunction extends FunctionImplN {
\r
11 public ClassMethodFunction(Method method) {
\r
12 super(method.getParameterTypes().length);
\r
13 this.method = method;
\r
16 public Method getMethod() {
\r
21 public Object doApply(Object... ps) {
\r
23 return method.invoke(null, ps);
\r
24 } catch (IllegalArgumentException e) {
\r
25 throw new RuntimeException(e);
\r
26 } catch (IllegalAccessException e) {
\r
27 throw new RuntimeException(e);
\r
28 } catch (InvocationTargetException e) {
\r
29 //e.printStackTrace();
\r
30 throw new RuntimeException(e);
\r
35 public String toString() {
\r
36 return method.getName();
\r