java.lang.Object | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | - | - | java.lang.reflect.AccessibleObject | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | - | - | java.lang.reflect.Method | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A Method provides information about a method on a class or interface.
Get annotations
Return | Method | Summary |
---|---|---|
<T extends Annotation>T | 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. |
Get its class or interface
Return | Method | Summary |
---|---|---|
Class<?> | getDeclaringClass() | Returns the Class object representing the class or interface that declares the method represented by this Method object. |
Get default value for the annotation member
Return | Method | Summary |
---|---|---|
Object | getDefaultValue() | Returns the default value for the annotation member represented by this Method instance. |
Get declared exceptions
Return | Method | Summary |
---|---|---|
Class<?>[] | getExceptionTypes() | Returns an array of Class objects that represent the types of the exceptions declared to be thrown by the underlying method represented by this Method object. |
Type[] | getGenericExceptionTypes() | Returns an array of Type objects that represent the exceptions declared to be thrown by this Method object. |
Get parameter types
Return | Method | Summary |
---|---|---|
Type[] | getGenericParameterTypes() | Returns an array of Type objects that represent the formal parameter types, in declaration order, of the method represented by this Method object. |
Class<?>[] | getParameterTypes() | Returns an array of Class objects that represent the formal parameter types, in declaration order, of the method represented by this Method object. |
Get return type
Return | Method | Summary |
---|---|---|
Type | getGenericReturnType() | Returns a Type object that represents the formal return type of the method represented by this Method object. |
Class<?> | getReturnType() | Returns a Class object that represents the formal return type of the method represented by this Method object. |
Get modifiers and name for this method
Return | Method | Summary |
---|---|---|
int | getModifiers() | Returns the Java language modifiers for the method represented by this Method object, as an integer. |
String | getName() | Returns the name of the method represented by this Method object, as a String. |
Get annotations on the formal parameters
Return | Method | Summary |
---|---|---|
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. |
Get the type variables for this method
Return | Method | Summary |
---|---|---|
TypeVariable<Method>[] | getTypeParameters() | Returns an array of TypeVariable objects that represent the type variables declared by the generic declaration represented by this GenericDeclaration object, in declaration order. |
Invoke this method
Return | Method | Summary |
---|---|---|
Object | invoke(Object obj, Object... args) | Invokes the underlying method represented by this Method object, on the specified object with the specified parameters. |
Is this method bridge method, synthetic method and has variable number of arguments
Return | Method | Summary |
---|---|---|
boolean | isBridge() | Returns true if this method is a bridge method; returns false otherwise. |
boolean | isSynthetic() | Returns true if this method is a synthetic method; returns false otherwise. |
boolean | isVarArgs() | Returns true if this method was declared to take a variable number of arguments; returns false otherwise. |
Get the string representation of the method
Return | Method | Summary |
---|---|---|
String | toGenericString() | Returns a string describing this Method, including type parameters. |
String | toString() | Returns a string describing this Method. |
java2s.com | Contact Us | Privacy Policy |
Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
All other trademarks are property of their respective owners. |