|
|
|||||||||
| 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
Method enables reflection access to Java methods.
| Field Summary |
|---|
| Fields inherited from interface java.lang.reflect.Member |
|---|
DECLARED, PUBLIC |
| Method Summary | ||
|---|---|---|
boolean |
equals(Object obj)
equals compares two methods. |
|
|
getAnnotation(Class<T> annotationClass)
Returns this element's annotation for the specified type if such an annotation is present, else null. |
|
Annotation[] |
getDeclaredAnnotations()
Returns all annotations that are directly present on this element. |
|
Class<?> |
getDeclaringClass()
getDeclaringClass returns the class this method was declared in. |
|
Object |
getDefaultValue()
Returns the default value for the annotation member represented by this Method instance. |
|
Class<?>[] |
getExceptionTypes()
getExceptionTypes returns an array of all declared exceptions of this method. |
|
Type[] |
getGenericExceptionTypes()
getGenericExceptionTypes NYI: COMMENT: JDK 1.5 method description |
|
Type[] |
getGenericParameterTypes()
getGenericParameterTypes NYI: COMMENT: JDK 1.5 method description |
|
Type |
getGenericReturnType()
getGenericReturnType NYI: COMMENT: JDK 1.5 method description |
|
int |
getModifiers()
getModifiers returns the set of modifiers set for this method. |
|
String |
getName()
getName returns the name of this method. |
|
Annotation[][] |
getParameterAnnotations()
Returns an array of arrays that represent the annotations on the formal parameters, in declaration order, of the method represented by this Method object. |
|
Class<?>[] |
getParameterTypes()
getParameterTypes returns an array with the type of all the parameters of this method. |
|
Class<?> |
getReturnType()
getReturnType returns the return type of this method. |
|
TypeVariable<?>[] |
getTypeParameters()
getTypeParameters NYI: COMMENT: JDK 1.5 method description |
|
int |
hashCode()
hashCode returns a hash code for this field |
|
Object |
invoke(Object obj,
Object... args)
invoke executes this method with the given arguments |
|
boolean |
isBridge()
Returns true if this method is a bridge
method; returns false otherwise. |
|
boolean |
isSynthetic()
isSynthetic NYI: COMMENT: JDK 1.5 method description |
|
boolean |
isVarArgs()
isVarArgs NYI: COMMENT: JDK 1.5 method description |
|
String |
toGenericString()
toGenericString NYI: COMMENT: JDK 1.5 method description |
|
String |
toString()
toString converts this method into a string such as "public int java.lang.Integer.intValue()" |
|
| Methods inherited from class java.lang.reflect.AccessibleObject |
|---|
getAnnotations, isAccessible, isAnnotationPresent, setAccessible, setAccessible |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public Class<?> getDeclaringClass()
getDeclaringClass in interface MemberMember.getDeclaringClass()public String getName()
getName in interface Memberpublic int getModifiers()
getModifiers in interface MemberModifierpublic Class<?> getReturnType()
public Class<?>[] getParameterTypes()
public Class<?>[] getExceptionTypes()
public boolean equals(Object obj)
equals in class Objectobj - another method
public int hashCode()
hashCode in class Objectpublic String toString()
toString in class Object
public Object invoke(Object obj,
Object... args)
throws IllegalAccessException,
IllegalArgumentException,
InvocationTargetException
obj - the target object of this method if this is an
instance method. Ignored in case of a static method.args - the arguments to be passed to this method.
NullPointerException - if this is an instance method and
obj is null.
IllegalAccessException - if the caller does not have the
right to access this method.
InvocationTargetException - if this method returns with an
exception, this exception is replaced by an instance of
InvocationTargetException.
ExceptionInInitializerError - if this is a static method
and initialization of the declaring class failed.
IllegalArgumentExceptionpublic TypeVariable<?>[] getTypeParameters()
NYI: COMMENT: JDK 1.5 method description
getTypeParameters in interface GenericDeclarationpublic Type getGenericReturnType()
NYI: COMMENT: JDK 1.5 method description
public Type[] getGenericExceptionTypes()
NYI: COMMENT: JDK 1.5 method description
public Type[] getGenericParameterTypes()
NYI: COMMENT: JDK 1.5 method description
public String toGenericString()
NYI: COMMENT: JDK 1.5 method description
public boolean isSynthetic()
NYI: COMMENT: JDK 1.5 method description
isSynthetic in interface Memberpublic boolean isVarArgs()
NYI: COMMENT: JDK 1.5 method description
public boolean isBridge()
true if this method is a bridge
method; returns false otherwise.
public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
AnnotatedElement
getAnnotation in interface AnnotatedElementgetAnnotation in class AccessibleObjectannotationClass - the Class object corresponding to the
annotation type
NullPointerException - if the given annotation class is nullpublic Annotation[] getDeclaredAnnotations()
AnnotatedElement
getDeclaredAnnotations in interface AnnotatedElementgetDeclaredAnnotations in class AccessibleObjectpublic Annotation[][] getParameterAnnotations()
Method object. (Returns an array of length zero if the
underlying method is parameterless. If the method has one or more
parameters, a nested array of length zero is returned for each parameter
with no annotations.) The annotation objects contained in the returned
arrays are serializable. The caller of this method is free to modify
the returned arrays; it will have no effect on the arrays returned to
other callers.
public Object getDefaultValue()
Method instance. If the member is of a primitive type,
an instance of the corresponding wrapper type is returned. Returns
null if no default is associated with the member, or if the method
instance does not represent a declared member of an annotation type.
Method instance.
TypeNotPresentException - if the annotation is of type
Class and no definition can be found for the
default class value.
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||