|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.reflect.AccessibleObject
java.lang.reflect.Method
public final class Method
This class models a method. Information about the method can be accessed, and the method can be invoked dynamically.
| Field Summary |
|---|
| Fields inherited from class java.lang.reflect.AccessibleObject |
|---|
flag, trans |
| Fields inherited from interface java.lang.reflect.Member |
|---|
DECLARED, PUBLIC |
| Constructor Summary | |
|---|---|
Method(Method orig)
Construct a clone of the given instance. |
|
| Method Summary | |
|---|---|
boolean |
equals(Object object)
Compares the specified object to this Method and determines if they are equal. |
Annotation[] |
getDeclaredAnnotations()
Gets all Annotations that are explicitly declared by this
element (not inherited). |
Class<?> |
getDeclaringClass()
Return the Class associated with the class that defined this
method. |
Object |
getDefaultValue()
Gets the default value for the annotation member represented by this method. |
Class<?>[] |
getExceptionTypes()
Return an array of the Class objects associated with the
exceptions declared to be thrown by this method. |
Type[] |
getGenericExceptionTypes()
Gets the exception types as an array of Type instances. |
Type[] |
getGenericParameterTypes()
Gets the parameter types as an array of Type instances, in
declaration order. |
Type |
getGenericReturnType()
Gets the return type as a Type instance. |
int |
getModifiers()
Return the modifiers for the modeled method. |
String |
getName()
Return the name of the modeled method. |
Annotation[][] |
getParameterAnnotations()
Gets an array of arrays that represent the annotations of the formal parameters of this 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. |
(package private) String |
getSignatureAttribute()
Gets the Signature attribute for this instance. |
TypeVariable<Method>[] |
getTypeParameters()
Returns the generic declared types in declaration order. |
int |
hashCode()
Returns an integer hash code for the receiver. |
Object |
invoke(Object receiver,
Object... args)
Return the result of dynamically invoking the modeled method. |
boolean |
isBridge()
Indicates whether or not this method is a bridge. |
boolean |
isSynthetic()
Indicates whether or not this method is synthetic. |
boolean |
isVarArgs()
Indicates whether or not this method takes a variable number argument. |
(package private) static Annotation[][] |
noAnnotations(int size)
Creates an array of empty Annotation arrays. |
String |
toGenericString()
Returns the String representation of the method's declaration, including the type parameters. |
String |
toString()
Returns a string containing a concise, human-readable description of the receiver. |
| Methods inherited from class java.lang.reflect.AccessibleObject |
|---|
appendArrayGenericType, appendArrayType, appendArrayType, appendGenericType, appendSimpleType, getAnnotation, getAnnotations, getClassSignatureAttribute, getReflectionAccess, getSignature, isAccessible, isAnnotationPresent, setAccessible, setAccessible, setAccessibleNoCheck, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
Method(Method orig)
orig - non-null; the original instance to clone| Method Detail |
|---|
public TypeVariable<Method>[] getTypeParameters()
GenericDeclaration
getTypeParameters in interface GenericDeclarationString getSignatureAttribute()
null if not found.
getSignatureAttribute in class AccessibleObjectpublic String toGenericString()
Returns the String representation of the method's declaration, including the type parameters.
public Type[] 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.
Type instances.
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.public Type[] getGenericExceptionTypes()
Gets the exception types as an array of Type instances. If the
method has no declared exceptions, then an empty array is returned.
Type instances.
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.public Type getGenericReturnType()
Gets the return type as a Type instance.
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.public Annotation[] getDeclaredAnnotations()
AnnotatedElementAnnotations that are explicitly declared by this
element (not inherited).
getDeclaredAnnotations in interface AnnotatedElementgetDeclaredAnnotations in class AccessibleObjectAnnotations, which may be empty, but never
null.static Annotation[][] noAnnotations(int size)
public Annotation[][] 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.
Annotation instances.public boolean isVarArgs()
Indicates whether or not this method takes a variable number argument.
true if a vararg is declare, otherwise
false.public boolean isBridge()
Indicates whether or not this method is a bridge.
true if this method's a bridge,
otherwise false.public boolean isSynthetic()
Indicates whether or not this method is synthetic.
isSynthetic in interface Membertrue if this method is synthetic,
otherwise false.public Object 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.public boolean equals(Object object)
equals in class Objectobject - the object to compare
hashCode()public Class<?> getDeclaringClass()
Class associated with the class that defined this
method.
getDeclaringClass in interface Memberpublic Class<?>[] getExceptionTypes()
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.
public int getModifiers()
getModifiers in interface MemberModifierpublic String getName()
getName in interface Memberpublic Class<?>[] getParameterTypes()
Class objects associated with the
parameter types of this method. If the method was declared with no
parameters, the array returned will be empty.
public Class<?> getReturnType()
Class associated with the return type of this
method.
public int hashCode()
hashCode in class Objectequals(java.lang.Object)
public Object invoke(Object receiver,
Object... args)
throws IllegalAccessException,
IllegalArgumentException,
InvocationTargetException
receiver.methodName(arg1, arg2, ... , argN) This method
performs the following:
receiver - The object on which to call the modeled methodargs - the arguments to the method
NullPointerException - if the receiver is null for a non-static method
IllegalAccessException - if the modeled 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 methodAccessibleObjectpublic String toString()
public native Object java.lang.Method.invoke(Object,Object) throws IllegalAccessException,IllegalArgumentException,InvocationTargetException
toString in class Object
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||