This class models a method. Information about the method can be accessed, and the method can be invoked dynamically.
Public Member Functions | |
TypeVariable< Method >[] | getTypeParameters () |
String | toGenericString () |
Type[] | getGenericParameterTypes () |
Type[] | getGenericExceptionTypes () |
Type | getGenericReturnType () |
Annotation[][] | getParameterAnnotations () |
boolean | isVarArgs () |
boolean | isBridge () |
boolean | isSynthetic () |
Object | getDefaultValue () |
boolean | equals (Object object) |
Compares the specified object to this Method and answer if they are equal. | |
Class<?> | getDeclaringClass () |
Return the Class associated with the class that defined this method. | |
Class<?>[] | getExceptionTypes () |
Return an array of the Class objects associated with the exceptions declared to be thrown by this method. | |
int | getModifiers () |
Return the modifiers for the modeled method. | |
String | getName () |
Return the name of the modeled method. | |
Class<?>[] | getParameterTypes () |
Return an array of the Class objects associated with the parameter types of this method. | |
Class<?> | getReturnType () |
Return the Class associated with the return type of this method. | |
int | hashCode () |
Answers an integer hash code for the receiver. | |
Object | invoke (Object receiver, Object...args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException |
Return the result of dynamically invoking the modeled method. | |
String | toString () |
Answers a string containing a concise, human-readable description of the receiver. | |
Private Member Functions | |
Method () | |
Prevent this class from being instantiated. |
java.lang.reflect.Method.Method | ( | ) | [private] |
Prevent this class from being instantiated.
String java.lang.reflect.Method.toGenericString | ( | ) |
Returns the String representation of the method's declaration, including the type parameters.
Type [] java.lang.reflect.Method.getGenericParameterTypes | ( | ) |
Gets the parameter types as an array of Type instances, in declaration order. If the method has no parameters, then an empty array is returned.
GenericSignatureFormatError | if the generic method signature is invalid. | |
TypeNotPresentException | if the component type points to a missing type. | |
MalformedParameterizedTypeException | if the component type points to a type that can't be instantiated for some reason. |
Type [] java.lang.reflect.Method.getGenericExceptionTypes | ( | ) |
Gets the exception types as an array of Type instances. If the method has no declared exceptions, then an empty array is returned.
GenericSignatureFormatError | if the generic method signature is invalid. | |
TypeNotPresentException | if the component type points to a missing type. | |
MalformedParameterizedTypeException | if the component type points to a type that can't be instantiated for some reason. |
Type java.lang.reflect.Method.getGenericReturnType | ( | ) |
Gets the return type as a Type instance.
GenericSignatureFormatError | if the generic method signature is invalid. | |
TypeNotPresentException | if the component type points to a missing type. | |
MalformedParameterizedTypeException | if the component type points to a type that can't be instantiated for some reason. |
Annotation [][] java.lang.reflect.Method.getParameterAnnotations | ( | ) |
Gets an array of arrays that represent the annotations of the formal parameters of this method. If there are no parameters on this method, then an empty array is returned. If there are no annotations set, then and array of empty arrays is returned.
boolean java.lang.reflect.Method.isVarArgs | ( | ) |
Indicates whether or not this method takes a variable number argument.
true
if a vararg is declare, otherwise false
. boolean java.lang.reflect.Method.isBridge | ( | ) |
Indicates whether or not this method is a bridge.
true
if this method's a bridge, otherwise false
. Object java.lang.reflect.Method.getDefaultValue | ( | ) |
Gets the default value for the annotation member represented by this method.
null
if none. TypeNotPresentException | if the annotation is of type Class and no definition can be found. |
boolean java.lang.reflect.Method.equals | ( | Object | object | ) |
Compares the specified object to this Method and answer if they are equal.
The object must be an instance of Method with the same defining class and parameter types.
object | the object to compare |
Class<?> java.lang.reflect.Method.getDeclaringClass | ( | ) |
Class<?> [] java.lang.reflect.Method.getExceptionTypes | ( | ) |
Return an array of the Class objects associated with the exceptions declared to be thrown by this method.
If the method was not declared to throw any exceptions, the array returned will be empty.
int java.lang.reflect.Method.getModifiers | ( | ) |
Return the modifiers for the modeled method.
The Modifier class should be used to decode the result.
Reimplemented from java.lang.reflect.AccessibleObject.
String java.lang.reflect.Method.getName | ( | ) |
Return the name of the modeled method.
Class<?> [] java.lang.reflect.Method.getParameterTypes | ( | ) |
Return an array of the Class objects associated with the parameter types of this method.
If the method was declared with no parameters, the array returned will be empty.
Class<?> java.lang.reflect.Method.getReturnType | ( | ) |
int java.lang.reflect.Method.hashCode | ( | ) |
Object java.lang.reflect.Method.invoke | ( | Object | receiver, | |
Object... | args | |||
) | throws IllegalAccessException, IllegalArgumentException, InvocationTargetException |
Return the result of dynamically invoking the modeled method.
This reproduces the effect of receiver.methodName(arg1, arg2, ... , argN)
This method performs the following:
receiver | The object on which to call the modeled method | |
args | the arguments to the method |
java.lang.NullPointerException | if the receiver is null for a non-static method | |
java.lang.IllegalAccessException | if the modeled method is not accessible | |
java.lang.IllegalArgumentException | if an incorrect number of arguments are passed, the receiver is incompatible with the declaring class, or an argument could not be converted by a widening conversion | |
java.lang.reflect.InvocationTargetException | if an exception was thrown by the invoked method |
String java.lang.reflect.Method.toString | ( | ) |
Answers a string containing a concise, human-readable description of the receiver.
The format of the string is modifiers (if any) return type declaring class name '.' method name '(' parameter types, separated by ',' ')' If the method throws exceptions, ' throws ' exception types, separated by ',' For example: public native Object java.lang.Method.invoke(Object,Object) throws IllegalAccessException,IllegalArgumentException,InvocationTargetException
Genereated on Tue Dec 9 14:09:48 2008 by Doxygen.
(c) Copyright 2005, 2008 The Apache Software Foundation or its licensors, as applicable.