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