01: /* MethodFunction.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: Thu Aug 30 12:11:21 2007, Created by tomyeh
10: }}IS_NOTE
11:
12: Copyright (C) 2007 Potix Corporation. All Rights Reserved.
13:
14: {{IS_RIGHT
15: This program is distributed under GPL Version 2.0 in the hope that
16: it will be useful, but WITHOUT ANY WARRANTY.
17: }}IS_RIGHT
18: */
19: package org.zkoss.xel.util;
20:
21: import java.lang.reflect.Method;
22:
23: import org.zkoss.lang.reflect.SerializableMethod;
24: import org.zkoss.xel.Function;
25:
26: /**
27: * A XEL function based on java.lang.reflect.Method.
28: * It is used by implementation of {@link org.zkoss.xel.ExpressionFactory}
29: * The user of XEL expressions rarely need it.
30: *
31: * @author tomyeh
32: * @since 3.0.0
33: */
34: public class MethodFunction extends SerializableMethod implements
35: Function {
36: public MethodFunction(Method method) {
37: super (method);
38: }
39:
40: public Class[] getParameterTypes() {
41: return getMethod().getParameterTypes();
42: }
43:
44: public Class getReturnType() {
45: return getMethod().getReturnType();
46: }
47:
48: public Object invoke(Object obj, Object[] args) throws Exception {
49: return getMethod().invoke(obj, args);
50: }
51:
52: public Method toMethod() {
53: return getMethod();
54: }
55: }
|