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 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Indicates whether or not the specified
object is equal to this
method. | |||||||||||
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
Class instances. | |||||||||||
Returns the exception types as an array of
Type instances. | |||||||||||
Returns the parameter types as an array of
Type instances, in
declaration order. | |||||||||||
Returns the return type of this method as a
Type instance. | |||||||||||
Returns the modifiers for this method.
| |||||||||||
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.
| |||||||||||
Returns an array of
Class objects associated with the parameter
types of this method. | |||||||||||
Returns the
Class associated with the return type of this
method. | |||||||||||
Returns the declared type parameters in declaration order.
| |||||||||||
Returns an integer hash code for this method.
| |||||||||||
Returns the result of dynamically invoking this method.
| |||||||||||
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
|
Indicates whether or not the specified object
is equal to this
method. To be equal, the specified object must be an instance
of Method
with the same declaring class and parameter types
as this method.
object | the object to compare |
---|
true
if the specified object is equal to this
method, false
otherwiseReturns, 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 noneTypeNotPresentException | if this annotation member is of type Class and 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 method. Objects which are equal return the same value for this method. The hash code for this Method is the hash code of the name of this method.
Returns the result of dynamically invoking this method. This reproduces
the effect of receiver.methodName(arg1, arg2, ... , argN)
This
method performs the following:
receiver | the object on which to call this method |
---|---|
args | the arguments to the method |
NullPointerException | if the receiver is null for a non-static method |
---|---|
IllegalAccessException | if this method is not accessible |
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 |
InvocationTargetException | if an exception was thrown by the invoked method |
Indicates 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