|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.spicefactory.cinnamon.reflect.MethodInvoker
public class MethodInvoker
MethodInvoker instances allow the reflective invocation of Methods with automatic parameter conversion.
Instances of MethodInvoker will be created with ReflectionFactory instances. For parameter
conversion they will use any Converter instances registered in that factory. Like all classes in this
package this class takes into account the "context" of the method invocation. That means that it will
resolve (if possible) any TypeVariables of the declaring class of the method from the perspective of
the context class. Example: Consider a generic class MyClass<E> with a method
setProperty(E value). If you invoke this method on a subclass like
MySubclass extends MyClass<String> that does not override the setProperty
method, normal reflection would still report Object (the erased type) for the parameter
type, which is not accurate. This class will correctly report String as the parameter type
and use this type information for any required parameter conversions.
| Method Summary | |
|---|---|
Method |
getMethod()
Returns the Method that this MethodInvoker wraps. |
int |
getParameterCount()
Returns the number of parameters this MethodInvoker expects. |
int |
getRank(Object[] methodParams)
Returns a numeric rank for the given method parameters. |
Object |
invoke(Object target,
Object[] methodParams)
Invokes this method on the given target instance. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public Method getMethod()
public int getRank(Object[] methodParams)
methodParams - the method parameters to analyze
public int getParameterCount()
public Object invoke(Object target,
Object[] methodParams)
throws MethodInvocationException
target - the target instance this method should be invoked onmethodParams - the parameters to be passed to the method
MethodInvocationException - if the method cannot be invoked, the target method threw an
Exception or parameter conversion failed
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||