|
ABLE 2.0.0 07/02/2003 10:25:01 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.able.AbleMethodAdaptor
An AbleMethodAdaptor is an encapsulated method that can be called to invoke a method and retrieve the method's value.
Field Summary | |
---|---|
protected java.lang.String |
myAdaptorName
The name of the method adaptor. |
protected java.lang.Class[] |
myArgList
myArgList is a list of the classes in the argument list. |
protected java.lang.String[] |
myArgListClassNames
A list of Strings, each of which is the class name of the type of the corresponding argument to be passed to the method when invoked. |
protected int |
myArity
The number of arguments this adaptor expects. |
protected java.lang.Object |
myDclMethodSource
myDclMethodSource is any arbitrary Class, Interface or object on which the method named in myMethodName is called. |
protected java.lang.reflect.Method |
myMethod
myMethod is the method object in myMethodSource. |
protected java.lang.String |
myMethodName
myMethodName is the name of an accessible method in myMethodSource. |
protected java.lang.Object |
myMethodSource
myMethodSource is any arbitrary object on which the method named in myMethodName is called. |
protected java.lang.Object |
myValue
The value returned by the method when it was last invoked. |
Constructor Summary | |
---|---|
AbleMethodAdaptor(java.lang.String theAdaptorName,
java.lang.Object theMethodSource,
java.lang.reflect.Method theMethod)
Constructs an AbleMethodAdaptor with the specified name, and encapsulate the specified method of the specified object. |
|
AbleMethodAdaptor(java.lang.String theAdaptorName,
java.lang.Object theMethodSource,
java.lang.String theMethodName,
java.lang.Class[] theMethodArgs)
Constructs an AbleMethodAdaptor with the specified name, and encapsulates the specified method of the specified object. |
Method Summary | |
---|---|
static java.lang.String |
Copyright()
Determine the copyright of this class. |
boolean |
equalsNameArity(AbleMethodAdaptor theMethodAdaptor)
Indicates whether this method adaptor is equal to the given method adaptor based on the adaptor's names (case sensitive) and number of arguments. |
java.lang.String |
getMethodName()
Returns the name of this method adaptor. |
java.lang.String |
getName()
Returns the name of this method adaptor. |
java.lang.String |
getNameWithArity()
Returns the name of this method adaptor appended with the expected number of arguments. |
java.lang.Class |
getReturnType()
Returns the data type of the value returned from the associated method invocation. |
java.lang.Object |
getValue()
Returns the value from the last method invocation. |
java.lang.Object |
invoke(java.lang.Object[] theMethodArgs)
Call the encapsulated object method and save the result. |
void |
setMethodSource(java.lang.Object source)
Change the method source object, provided it is an instance of the same class. |
java.lang.String |
toString()
Returns a string describing the contents of the object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.lang.String myAdaptorName
protected transient java.lang.Object myValue
protected java.lang.Object myMethodSource
protected java.lang.Object myDclMethodSource
protected java.lang.String myMethodName
protected transient java.lang.reflect.Method myMethod
protected java.lang.String[] myArgListClassNames
protected transient java.lang.Class[] myArgList
protected int myArity
This could be figured out dynamically each time the arity is needed, but as the arity never changes, it is figured out just once, when the adaptor is created.
Constructor Detail |
public AbleMethodAdaptor(java.lang.String theAdaptorName, java.lang.Object theMethodSource, java.lang.String theMethodName, java.lang.Class[] theMethodArgs) throws java.lang.NoSuchMethodException, java.lang.SecurityException
theAdaptorName
- The name of the method adaptor; it is this name that
can be referenced by agents and from within rules.theMethodSource
- The object whose method is invoked.theMethodName
- The name of the method to invoke.theMethodArgs
- A list of Class objects that represent the types of
arguments required by the named method. Null implies
an empty parameter array Class[]{}.java.lang.NoSuchMethodException
- If the method with argument list does not exist in source object
object classjava.lang.SecurityException
- If method is not accessible.public AbleMethodAdaptor(java.lang.String theAdaptorName, java.lang.Object theMethodSource, java.lang.reflect.Method theMethod)
theAdaptorName
- The name of the method adaptor; it is this name that
can be referenced by agents and from within rules.theMethodSource
- The object whose method is invoked.theMethod
- The method to invoke.Method Detail |
public java.lang.Object invoke(java.lang.Object[] theMethodArgs) throws java.lang.reflect.InvocationTargetException, java.lang.IllegalAccessException, java.lang.NoSuchMethodException, java.lang.SecurityException
theMethodArgs
- An array of objects that are passed to the invoked
method.java.lang.NoSuchMethodException
- If the method or method signature is not defined in the
source object.java.lang.reflect.InvocationTargetException
- If an exception was thrown by the invoked method.java.lang.SecurityException
- If the method is not public or otherwise accessible.java.lang.IllegalAccessException
- If the method is not public or otherwise accessible.public java.lang.String getName()
public java.lang.String getNameWithArity()
foo/3
.public java.lang.Object getValue()
public java.lang.Class getReturnType()
Object.class
is returned.
Primitives boolean, double, float, int, or long
are converted to the corresponding Java Objectpublic boolean equalsNameArity(AbleMethodAdaptor theMethodAdaptor)
public java.lang.String getMethodName()
public java.lang.String toString()
toString
in class java.lang.Object
public void setMethodSource(java.lang.Object source) throws AbleDataException
AbleDataException
- Never. If the source type is invalid for the Method, then a run-time exception
will be thrown by invoke(). Checking here is very very expensive.public static java.lang.String Copyright()
|
ABLE 2.0.0 07/02/2003 10:25:01 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |