View Javadoc

1   /*
2    * Copyright (C) 2004 TiongHiang Lee
3    *
4    * This library is free software; you can redistribute it and/or
5    * modify it under the terms of the GNU Lesser General Public
6    * License as published by the Free Software Foundation; either
7    * version 2.1 of the License, or (at your option) any later version.
8    *
9    * This library is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12   * Lesser General Public License for more details.
13   *
14   * You should have received a copy of the GNU Lesser General Public
15   * License along with this library; if not,  write to the Free Software
16   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17   *
18   * Email: thlee@onemindsoft.org
19   */
20  package org.onemind.commons.invoke;
21  
22  
23  /***
24   * Represents a function that can be invoked
25   * @author TiongHiang Lee (thlee@onemindsoft.org)
26   * @version $Id: InvocableFunction.java,v 1.4 2004/08/27 02:59:39 thlee Exp $ $Name:  $
27   */
28  public interface InvocableFunction
29  {
30      /***
31       * Invoke the function on the target object with argument args
32       * @param target the target
33       * @param args the arguments
34       * @return application specific object
35       * @throws Exception if there's problem completing the invocation
36       */
37      public Object invoke(Object target, Object[] args)
38          throws Exception;
39      
40      /***
41       * Get the name
42       * @return the name
43       */
44      public String getName();
45      
46      /***
47       * Get the argument types
48       * @return the argument type
49       */
50      public Class[] getArgTypes();
51      
52      /***
53       * Whether this method can be invoke on the given arguments
54       * @return true if can invoke on the arguments
55       */
56      public boolean canInvokeOn(Class args[]);
57      
58  }