public class ArMethod extends Object
Method
, except that it represents methods in Java source
(during annotation processing) vs. representing methods of runtime types.Method
,
ExecutableElement
Modifier and Type | Method and Description |
---|---|
E |
asElement()
Returns the underlying
Element for this object. |
boolean |
equals(Object o) |
static ArMethod |
forElement(ExecutableElement element)
Returns a method based on the specified element.
|
ArAnnotation |
getAnnotation(ArClass annotationClass)
Gets the annotation from the object that corresponds to the specified annotation type.
|
ArAnnotation |
getAnnotation(Class<? extends Annotation> annotationClass)
Gets the annotation from the object that corresponds to the specified annotation type.
|
<T extends Annotation> |
getAnnotationBridge(Class<T> annotationClass)
Gets an annotation bridge for the specified annotation type.
|
List<ArAnnotation> |
getAnnotations()
Gets all annotations for this object.
|
List<ArAnnotation> |
getDeclaredAnnotations()
Gets the annotations declared on this object.
|
ArClass |
getDeclaringClass()
Returns the class which declared this member.
|
Object |
getDefaultValue()
Returns the default value for an annotation method.
|
List<ArClass> |
getExceptionTypes()
Returns the list of declared exception types that can be thrown by this executable member.
|
List<ArType> |
getGenericExceptionTypes()
Returns the list of declared exception types that can be thrown by this executable memebr.
|
List<ArType> |
getGenericParameterTypes()
Returns the list of parameter types.
|
ArType |
getGenericReturnType()
Returns the method's return type.
|
EnumSet<ArModifier> |
getModifiers()
Returns the modifiers that apply to this member.
|
String |
getName()
Returns the member's name.
|
List<List<ArAnnotation>> |
getParameterAnnotations()
Returns lists of parameter annotations, one list for each parameter.
|
List<ArParameter<ArMethod>> |
getParameters()
Returns the method's list of parameters.
|
List<ArClass> |
getParameterTypes()
Returns the list of parameter types.
|
ArType |
getReceiverType()
Returns the method's receiver type or
null if the method is static. |
ArClass |
getReturnType()
Returns the method's return type.
|
List<ArTypeParameter<ArMethod>> |
getTypeParameters()
Returns the method's list of type variables.
|
int |
hashCode() |
boolean |
isAnnotationPresent(ArClass annotationClass)
Determines whether an annotation of the specified type exists on the object.
|
boolean |
isAnnotationPresent(Class<? extends Annotation> annotationClass)
Determines whether an annotation of the specified type exists on the object.
|
boolean |
isVarArgs()
Determines whether this executable member can be invoked with variable arity (aka var-args).
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getDeclaringClass, getModifiers, getName
getAnnotation, getAnnotation, getAnnotationBridge, getDeclaredAnnotations, isAnnotationPresent, isAnnotationPresent
public static ArMethod forElement(ExecutableElement element)
element
- the elementNullPointerException
- if the specified element is nullIllegalArgumentException
- if the specified element does not represent a
methodpublic List<ArTypeParameter<ArMethod>> getTypeParameters()
getTypeParameters()
, except that the return value has more
generic type information.getTypeParameters
in interface ArGenericDeclaration
public List<ArParameter<ArMethod>> getParameters()
getParameters()
, except that the return value has more
generic type information.getParameters
in interface ArExecutableMember
Executable.getParameters()
,
ExecutableElement.getParameters()
public ArClass getReturnType()
getGenericReturnType()
.Method.getReturnType()
public ArType getGenericReturnType()
Method.getGenericReturnType()
,
ExecutableElement.getReturnType()
public ArType getReceiverType()
null
if the method is static. The type of the
receiver is always the type of declaring class. This method can be used to extract type
annotations that are declared for the method receiver.Executable.getAnnotatedReceiverType()
,
ExecutableElement.getReceiverType()
public Object getDefaultValue()
null
is returned.
The type of the value is the same as found in the map returned by
ArAnnotation.getAnnotationAttributes()
.
null
if this is
not an annotation methodMethod.getDefaultValue()
,
ExecutableElement.getDefaultValue()
public List<ArClass> getParameterTypes()
ArExecutableMember
ArExecutableMember.getGenericParameterTypes()
.getParameterTypes
in interface ArExecutableMember
Executable.getParameterTypes()
public List<ArType> getGenericParameterTypes()
ArExecutableMember
getGenericParameterTypes
in interface ArExecutableMember
Executable.getGenericParameterTypes()
public boolean isVarArgs()
ArExecutableMember
isVarArgs
in interface ArExecutableMember
Executable.isVarArgs()
public List<List<ArAnnotation>> getParameterAnnotations()
ArExecutableMember
getParameterAnnotations
in interface ArExecutableMember
Executable.getParameterAnnotations()
public List<ArClass> getExceptionTypes()
ArExecutableMember
ArExecutableMember.getGenericExceptionTypes()
.getExceptionTypes
in interface ArExecutableMember
Executable.getExceptionTypes()
public List<ArType> getGenericExceptionTypes()
ArExecutableMember
getGenericExceptionTypes
in interface ArExecutableMember
Executable.getGenericExceptionTypes()
,
ExecutableElement.getThrownTypes()
public boolean equals(Object o)
public int hashCode()
public String toString()
public ArClass getDeclaringClass()
ArMember
getDeclaringClass
in interface ArMember
Member.getDeclaringClass()
public EnumSet<ArModifier> getModifiers()
ArMember
java.lang.reflect.Member.getModifiers()
, this
returns a set of modifiers (defined in an enum) instead of a bitmasked
integer.getModifiers
in interface ArMember
Member.getModifiers()
public String getName()
ArMember
public List<ArAnnotation> getAnnotations()
ArAnnotatedConstruct
getAnnotations
in interface ArAnnotatedConstruct
public E asElement()
ArAnnotatedElement
Element
for this object.asElement
in interface ArAnnotatedElement
public ArAnnotation getAnnotation(ArClass annotationClass)
ArAnnotatedConstruct
getAnnotation
in interface ArAnnotatedConstruct
annotationClass
- the annotation typenull
if there is no such annotationpublic ArAnnotation getAnnotation(Class<? extends Annotation> annotationClass)
ArAnnotatedConstruct
getAnnotation
in interface ArAnnotatedConstruct
annotationClass
- the annotation typenull
if there is no such annotationpublic <T extends Annotation> T getAnnotationBridge(Class<T> annotationClass)
ArAnnotatedConstruct
getAnnotationBridge
in interface ArAnnotatedConstruct
T
- the type of the annotationannotationClass
- the annotation typenull
if
there is no such annotationArAnnotatedConstruct.getAnnotation(Class)
,
ArAnnotationBridge.createBridge(ArAnnotation, Class)
public boolean isAnnotationPresent(ArClass annotationClass)
ArAnnotatedConstruct
isAnnotationPresent
in interface ArAnnotatedConstruct
annotationClass
- the annotation typepublic boolean isAnnotationPresent(Class<? extends Annotation> annotationClass)
ArAnnotatedConstruct
isAnnotationPresent
in interface ArAnnotatedConstruct
annotationClass
- the annotation typepublic List<ArAnnotation> getDeclaredAnnotations()
ArAnnotatedConstruct
getDeclaredAnnotations
in interface ArAnnotatedConstruct