1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.jexl.util;
18
19
20 import java.lang.reflect.InvocationTargetException;
21 import java.lang.reflect.Method;
22
23 import org.apache.commons.logging.Log;
24
25 /***
26 * Abstract class that is used to execute an arbitrary
27 * method that is in introspected. This is the superclass
28 * for the GetExecutor and PropertyExecutor.
29 *
30 * @since 1.0
31 * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
32 * @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
33 * @version $Id: AbstractExecutor.java 398171 2006-04-29 14:57:29Z dion $
34 */
35 public abstract class AbstractExecutor {
36 /*** The executor instance log. */
37 protected Log rlog = null;
38
39 /***
40 * Method to be executed.
41 */
42 protected Method method = null;
43
44 /***
45 * Execute method against context.
46 *
47 * @param o The owner.
48 * @return The return value.
49 * @throws IllegalAccessException Method is inaccessible.
50 * @throws InvocationTargetException Method body throws an exception.
51 */
52 public abstract Object execute(Object o)
53 throws IllegalAccessException, InvocationTargetException;
54
55 /***
56 * Tell whether the executor is alive by looking
57 * at the value of the method.
58 *
59 * @return boolean Whether the executor is alive.
60 */
61 public boolean isAlive() {
62 return (method != null);
63 }
64
65 /***
66 * Get the method to be executed.
67 *
68 * @return Method The method to be executed.
69 */
70 public Method getMethod() {
71 return method;
72 }
73 }