| java.lang.Object | ||
| ↳ | java.lang.reflect.AccessibleObject | |
| ↳ | java.lang.reflect.Method | |
This class represents a method. Information about the method can be accessed, and the method can be invoked dynamically.
| [Expand] Inherited Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|  From interface
java.lang.reflect.Member | |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| 
          Returns true if  otherhas the same declaring class, name,
 parameters and return type as this method. | |||||||||||
| 
          Returns, for this element, the annotation with the specified type, or
  nullif no annotation with the specified type is present
 (including inherited annotations). | |||||||||||
| 
          Returns, for this element, the annotation with the specified type, or
  nullif no annotation with the specified type is present
 (including inherited annotations). | |||||||||||
| 
          Returns, for this element, an array containing all annotations (including
 inherited annotations).
          
    
         | |||||||||||
| 
          Returns, for this element, all annotations that are explicitly declared
 (not inherited).
          
    
         | |||||||||||
| 
          Returns the class that declares this method.
          
    
         | |||||||||||
| 
          Returns the default value for the annotation member represented by this
 method.
          
    
         | |||||||||||
| 
          Returns the exception types as an array of  Classinstances. | |||||||||||
| 
          Returns the exception types as an array of  Typeinstances. | |||||||||||
| 
          Returns the parameter types as an array of  Typeinstances, in
 declaration order. | |||||||||||
| 
          Returns the return type of this method as a  Typeinstance. | |||||||||||
| 
          Returns the modifiers for this method.
          
    
         | |||||||||||
| 
          Returns the name of the method represented by this  Methodinstance. | |||||||||||
| 
          Returns an array of arrays that represent the annotations of the formal
 parameters of this method.
          
    
         | |||||||||||
| 
          Returns an array of  Classobjects associated with the parameter
 types of this method. | |||||||||||
| 
          Returns the  Classassociated with the return type of this
 method. | |||||||||||
| 
          Returns the declared type parameters in declaration order.
          
    
         | |||||||||||
| 
          Returns an integer hash code for this object.
  Equivalent to  | |||||||||||
| 
          Returns the result of dynamically invoking this method.
          
    
         | |||||||||||
| 
          Indicates whether or not this element has an annotation with the
 specified annotation type (including inherited annotations).
          
    
         | |||||||||||
| 
          Indicates whether or not this method is a bridge.
          
    
         | |||||||||||
| 
          Indicates whether or not this method is synthetic.
          
    
         | |||||||||||
| 
          Indicates whether or not this method takes a variable number argument.
          
    
         | |||||||||||
| 
          Returns the string representation of the method's declaration, including
 the type parameters.
          
    
         | |||||||||||
| 
          Returns a string containing a concise, human-readable description of this
 method.
          
    
         | |||||||||||
| [Expand] Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|  From class
  java.lang.reflect.AccessibleObject | |||||||||||
|  From class
  java.lang.Object | |||||||||||
|  From interface
  java.lang.reflect.AnnotatedElement | |||||||||||
|  From interface
  java.lang.reflect.GenericDeclaration | |||||||||||
|  From interface
  java.lang.reflect.Member | |||||||||||
Returns true if other has the same declaring class, name,
 parameters and return type as this method.
| other | the object to compare this instance with. | 
|---|
true if the specified object is equal to this Object; false otherwise.Returns, for this element, the annotation with the specified type, or
 null if no annotation with the specified type is present
 (including inherited annotations).
| annotationClass | the type of the annotation to search for | 
|---|
nullReturns, for this element, the annotation with the specified type, or
 null if no annotation with the specified type is present
 (including inherited annotations).
| annotationType | the type of the annotation to search for | 
|---|
nullReturns, for this element, an array containing all annotations (including inherited annotations). If there are no annotations present, this method returns a zero length array.
Returns, for this element, all annotations that are explicitly declared (not inherited). If there are no declared annotations present, this method returns a zero length array.
Returns the class that declares this method.
Returns the default value for the annotation member represented by this method.
null if none| TypeNotPresentException | if this annotation member is of type Classand no
             definition can be found | 
|---|
Returns the exception types as an array of Class instances. If
 this method has no declared exceptions, an empty array is returned.
Returns the exception types as an array of Type instances. If
 this method has no declared exceptions, an empty array will be returned.
| GenericSignatureFormatError | if the generic method signature is invalid | 
|---|---|
| TypeNotPresentException | if any exception type points to a missing type | 
| MalformedParameterizedTypeException | if any exception type points to a type that cannot be instantiated for some reason | 
Returns the parameter types as an array of Type instances, in
 declaration order. If this method has no parameters, an empty array is
 returned.
| GenericSignatureFormatError | if the generic method signature is invalid | 
|---|---|
| TypeNotPresentException | if any parameter type points to a missing type | 
| MalformedParameterizedTypeException | if any parameter type points to a type that cannot be instantiated for some reason | 
Returns the return type of this method as a Type instance.
| GenericSignatureFormatError | if the generic method signature is invalid | 
|---|---|
| TypeNotPresentException | if the return type points to a missing type | 
| MalformedParameterizedTypeException | if the return type points to a type that cannot be instantiated for some reason | 
Returns the name of the method represented by this Method
 instance.
Returns 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.
Annotation instances
Returns an array of Class objects associated with the parameter
 types of this method. If the method was declared with no parameters, an
 empty array will be returned.
Returns the Class associated with the return type of this
 method.
Returns the declared type parameters in declaration order. If there are no type parameters, this method returns a zero length array.
Returns an integer hash code for this object. By contract, any two
 objects for which equals(Object) returns true must return
 the same hash code value. This means that subclasses of Object
 usually override both methods or neither method.
 
Note that hash values must not change over time unless information used in equals comparisons also changes.
See Writing a correct
 hashCode method
 if you intend implementing your own hashCode method.
 
Equivalent to getDeclaringClass().getName().hashCode() ^ getName().hashCode().
Returns the result of dynamically invoking this method. Equivalent to
 receiver.methodName(arg1, arg2, ... , argN).
 
If the method is static, the receiver argument is ignored (and may be null).
If the method takes no arguments, you can pass (Object[]) null instead of
 allocating an empty array.
 
If you're calling a varargs method, you need to pass an Object[] for the
 varargs parameter: that conversion is usually done in javac, not the VM, and
 the reflection machinery does not do this for you. (It couldn't, because it would be
 ambiguous.)
 
Reflective method invocation follows the usual process for method lookup.
If an exception is thrown during the invocation it is caught and wrapped in an InvocationTargetException. This exception is then thrown.
If the invocation completes normally, the return value itself is returned. If the method is declared to return a primitive type, the return value is boxed. If the return type is void, null is returned.
| receiver | the object on which to call this method (or null for static methods) | 
|---|---|
| args | the arguments to the method | 
| NullPointerException | if receiver == nullfor a non-static method | 
|---|---|
| IllegalAccessException | if this method is not accessible (see AccessibleObject) | 
| IllegalArgumentException | if the number of arguments doesn't match the number of parameters, the receiver is incompatible with the declaring class, or an argument could not be unboxed or converted by a widening conversion to the corresponding parameter type | 
| InvocationTargetException | if an exception was thrown by the invoked method | 
Indicates whether or not this element has an annotation with the specified annotation type (including inherited annotations).
| annotationType | the type of the annotation to search for | 
|---|
true if the annotation exists, false otherwiseIndicates whether or not this method is a bridge.
true if this method is a bridge, false otherwise
Indicates whether or not this method is synthetic.
true if this method is synthetic, false otherwise
Indicates whether or not this method takes a variable number argument.
true if a vararg is declared, false otherwise
Returns the string representation of the method's declaration, including the type parameters.
Returns a string containing a concise, human-readable description of this method. The format of the string is:
public native Object
 java.lang.Method.invoke(Object,Object) throws
 IllegalAccessException,IllegalArgumentException
 ,InvocationTargetException