package org.simantics.scl.reflection.functions; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import org.simantics.scl.runtime.function.FunctionImpl3; public class ClassMethodFunction3 extends FunctionImpl3 { Method method; public ClassMethodFunction3(Method method) { this.method = method; } public Method getMethod() { return method; } @Override public Object apply(Object p0, Object p1, Object p2) { try { return method.invoke(null, p0, p1, p2); } 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(); } }