]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.reflection/src/org/simantics/scl/reflection/functions/ClassMethodFunction3.java
17dafa3ec964dee2ba07a227c7972323192fd6be
[simantics/platform.git] / bundles / org.simantics.scl.reflection / src / org / simantics / scl / reflection / functions / ClassMethodFunction3.java
1 package org.simantics.scl.reflection.functions;\r
2 \r
3 import java.lang.reflect.InvocationTargetException;\r
4 import java.lang.reflect.Method;\r
5 \r
6 import org.simantics.scl.runtime.function.FunctionImpl3;\r
7 import org.simantics.scl.runtime.function.FunctionImplN;\r
8 \r
9 public class ClassMethodFunction3 extends FunctionImpl3 {\r
10     Method method;\r
11 \r
12     public ClassMethodFunction3(Method method) {\r
13         this.method = method;\r
14     }\r
15     \r
16     public Method getMethod() {\r
17         return method;\r
18     }\r
19 \r
20     @Override\r
21     public Object apply(Object p0, Object p1, Object p2) {\r
22         try {\r
23             return method.invoke(null, p0, p1, p2);\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
31         }\r
32     }\r
33     \r
34     @Override\r
35     public String toString() {\r
36         return method.getName();\r
37     }\r
38 }\r