|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public static interface Reflection.Method
This interface represents a run-time method obtained through reflection.
Here are few examples of utilization:
// Non-static method: fastMap.put(myKey, myValue)
Reflection.Method putKeyValue
= Reflection.getInstance().getMethod(
"javolution.util.FastMap.put(java.lang.Object, java.lang.Object)");
Object previous = putKeyValue.invoke(fastMap, myKey, myValue);
// Static method: System.nanoTime() (JRE1.5+)
Reflection.Method nanoTime
= Reflection.getInstance().getMethod("java.lang.System.nanoTime()");
long time = ((Long)nanoTime.invoke(null)).longValue();
Method Summary | |
---|---|
Class[] |
getParameterTypes()
Returns an array of Class objects that represents
the formal parameter types, in declaration order of this constructor. |
Object |
invoke(Object thisObject)
Invokes this method on the specified object which might be null if the method is static (convenience method). |
Object |
invoke(Object thisObject,
Object... args)
Invokes this method with the specified arguments on the specified object which might be null
if the method is static. |
Object |
invoke(Object thisObject,
Object arg0)
Invokes this method with the specified single argument on the specified object which might be null
if the method is static (convenience method). |
Object |
invoke(Object thisObject,
Object arg0,
Object arg1)
Invokes this method with the specified two arguments on the specified object which might be null
if the method is static (convenience method). |
Object |
invoke(Object thisObject,
Object arg0,
Object arg1,
Object arg2)
Invokes this method with the specified three arguments on the specified object which might be null
if the method is static. |
Method Detail |
---|
Class[] getParameterTypes()
Class
objects that represents
the formal parameter types, in declaration order of this constructor.
Object invoke(Object thisObject)
null
if the method is static (convenience method).
thisObject
- the object upon which this method is invoked
or null
for static methods.
IllegalArgumentException
- if
this.getParametersTypes().length != 0
Object invoke(Object thisObject, Object arg0)
null
if the method is static (convenience method).
thisObject
- the object upon which this method is invoked
or null
for static methods.arg0
- the single argument.
IllegalArgumentException
- if
this.getParametersTypes().length != 1
Object invoke(Object thisObject, Object arg0, Object arg1)
null
if the method is static (convenience method).
thisObject
- the object upon which this method is invoked
or null
for static methods.arg0
- the first argument.arg1
- the second argument.
IllegalArgumentException
- if
this.getParametersTypes().length != 2
Object invoke(Object thisObject, Object arg0, Object arg1, Object arg2)
null
if the method is static.
thisObject
- the object upon which this method is invoked
or null
for static methods.arg0
- the first argument (convenience method).arg1
- the second argument.arg2
- the third argument.
IllegalArgumentException
- if
this.getParametersTypes().length != 3
Object invoke(Object thisObject, Object... args)
null
if the method is static.
thisObject
- the object upon which this method is invoked
or null
for static methods.args
- the arguments.
IllegalArgumentException
- if
this.getParametersTypes().length != args.length
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |