|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface ReflectionMethod
A wrapper around a Method allowing have different implemenatons of it.
| Method Summary | ||
|---|---|---|
|
getAnnotation(Class<A> annotationType)
Returns this element's annotation for the specified type if such an annotation is present, else null. |
|
Class<?> |
getDeclaringClass()
Returns the Class object representing the class or interface that declares the member or constructor represented by this Member. |
|
Class[] |
getExceptionTypes()
Returns an array of Class objects that represent
the types of the exceptions declared to be thrown
by the underlying method
represented by this IMethod object. |
|
Type |
getGenericReturnType()
Returns a Type object that represents the formal return type of the method represented by this Method object. |
|
Method |
getMethod()
Return a reference to the Method that this ReflectionMethod
represent. |
|
int |
getModifiers()
Returns the Java language modifiers for the member or constructor represented by this Member, as an integer. |
|
String |
getName()
Returns the simple name of the underlying member or constructor represented by this Member. |
|
Class<?>[] |
getParameterTypes()
Returns an array of Class objects that represent the formal
parameter types, in declaration order, of the method
represented by this Method object. |
|
Class<?> |
getReturnType()
Returns a Class object that represents the formal return type
of the method represented by this IMethod object. |
|
Object |
invoke(Object obj,
Object... args)
Invokes the underlying method represented by this IMethod
object, on the specified object with the specified parameters. |
|
| Method Detail |
|---|
Class<?> getDeclaringClass()
String getName()
int getModifiers()
ModifierClass<?> getReturnType()
Class object that represents the formal return type
of the method represented by this IMethod object.
Class<?>[] getParameterTypes()
Class objects that represent the formal
parameter types, in declaration order, of the method
represented by this Method object. Returns an array of length
0 if the underlying method takes no parameters.
Class[] getExceptionTypes()
Class objects that represent
the types of the exceptions declared to be thrown
by the underlying method
represented by this IMethod object. Returns an array of length
0 if the method declares no exceptions in its throws clause.
<A extends Annotation> A getAnnotation(Class<A> annotationType)
annotationType - the Class object corresponding to the
annotation type
NullPointerException - if annotationType is nullType getGenericReturnType()
If the return type is a parameterized type, the Type object returned must accurately reflect the actual type parameters used in the source code.
If the return type is a type variable or a parameterized type, it is created. Otherwise, it is resolved.
GenericSignatureFormatError - if the generic method signature does not conform to the format
specified in the Java Virtual Machine Specification, 3rd edition
TypeNotPresentException - if the underlying method's
return type refers to a non-existent type declaration
MalformedParameterizedTypeException - if the
underlying method's return typed refers to a parameterized
type that cannot be instantiated for any reason
Object invoke(Object obj,
Object... args)
throws IllegalAccessException,
IllegalArgumentException,
InvocationTargetException
IMethod
object, on the specified object with the specified parameters.
Individual parameters are automatically unwrapped to match
primitive formal parameters, and both primitive and reference
parameters are subject to method invocation conversions as
necessary.
obj - the object the underlying method is invoked fromargs - the arguments used for the method call
obj with parameters
args
IllegalAccessException - if this Method object
enforces Java language access control and the underlying
method is inaccessible.
IllegalArgumentException - if the method is an
instance method and the specified object argument
is not an instance of the class or interface
declaring the underlying method (or of a subclass
or implementor thereof); if the number of actual
and formal parameters differ; if an unwrapping
conversion for primitive arguments fails; or if,
after possible unwrapping, a parameter value
cannot be converted to the corresponding formal
parameter type by a method invocation conversion.
InvocationTargetException - if the underlying method
throws an exception.
NullPointerException - if the specified object is null
and the method is an instance method.
ExceptionInInitializerError - if the initialization
provoked by this method fails.Method getMethod()
Method that this ReflectionMethod
represent.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||