1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.onemind.commons.invoke;
21
22
23 /***
24 * An interface for a object provide information about
25 * functions that can be invoked on itself (through a key)
26 * and API for invoke the method on on itself
27 * @author TiongHiang Lee (thlee@onemindsoft.org)
28 * @version $Id: Invocable.java,v 1.2 2004/08/26 16:08:23 thlee Exp $ $Name: $
29 */
30 public interface Invocable
31 {
32 /***
33 * whether the function can be invoke with the arguments
34 * @param functionName the function name
35 * @param args the arguments
36 * @return true if can invoke
37 */
38 public boolean canInvoke(String functionName, Object[] args);
39
40 /***
41 * Get the function
42 * @param functionName the function name
43 * @param args the arguments
44 * @return the function, or null if the function cannot be found
45 */
46 public InvocableFunction getFunction(String functionName, Object[] args);
47
48 /***
49 * invoke the function with the arguments provided
50 * @param functionName the function name
51 * @param args the arguments
52 * @return the object returns from the invocation
53 * @throws Exception if there's problem invoking the function
54 */
55 public Object invoke(String functionName, Object[] args)
56 throws Exception;
57 }