- All Superinterfaces:
- AnnotatedConstruct,- Element,- Parameterizable
Represents a method, constructor, or initializer (static or
 instance) of a class or interface, including annotation interface
 elements.
 Annotation interface elements are methods restricted to have no
 formal parameters, no type parameters, and no 
throws
 clause, among other restrictions; see JLS 9.6.1 for details- Since:
- 1.6
- See Also:
- 
Method SummaryModifier and TypeMethodDescriptionasType()Returns the executable type defined by this executable element.Returns the default value if this executable is an annotation interface element.Returns the class or interface defining the executable.List<? extends VariableElement> Returns the formal parameters of this executable.Returns the return type of this executable.Returns the simple name of a constructor, method, or initializer.List<? extends TypeMirror> Returns the exceptions and other throwables listed in this method or constructor'sthrowsclause in declaration order.List<? extends TypeParameterElement> Returns the formal type parameters of this executable in declaration order.booleanReturnstrueif this method is a default method and returnsfalseotherwise.booleanReturnstrueif this method or constructor accepts a variable number of arguments and returnsfalseotherwise.Methods declared in interface javax.lang.model.element.Elementaccept, equals, getAnnotation, getAnnotationMirrors, getAnnotationsByType, getEnclosedElements, getKind, getModifiers, hashCode
- 
Method Details- 
asTypeTypeMirror asType()Returns the executable type defined by this executable element.- Specified by:
- asTypein interface- Element
- Returns:
- the executable type defined by this executable element
- See Also:
 
- 
getTypeParametersList<? extends TypeParameterElement> getTypeParameters()Returns the formal type parameters of this executable in declaration order.- Specified by:
- getTypeParametersin interface- Parameterizable
- Returns:
- the formal type parameters, or an empty list if there are none
 
- 
getReturnTypeTypeMirror getReturnType()Returns the return type of this executable. Returns aNoTypewith kindVOIDif this executable is not a method, or is a method that does not return a value.- Returns:
- the return type of this executable
 
- 
getParametersList<? extends VariableElement> getParameters()Returns the formal parameters of this executable. They are returned in declaration order.- Returns:
- the formal parameters, or an empty list if there are none
 
- 
getReceiverTypeTypeMirror getReceiverType()Returns the receiver type of this executable, orNoTypewith kindNONEif the executable has no receiver type. An executable which is an instance method, or a constructor of an inner class, has a receiver type derived from the declaring type. An executable which is a static method, or a constructor of a non-inner class, or an initializer (static or instance), has no receiver type.- Returns:
- the receiver type of this executable
- See Java Language Specification:
- 
8.4 Method Declarations
 8.4.1 Formal Parameters
 8.8 Constructor Declarations
- Since:
- 1.8
 
- 
isVarArgsboolean isVarArgs()Returnstrueif this method or constructor accepts a variable number of arguments and returnsfalseotherwise.- Returns:
- trueif this method or constructor accepts a variable number of arguments and returns- falseotherwise
 
- 
isDefaultboolean isDefault()Returnstrueif this method is a default method and returnsfalseotherwise.- Returns:
- trueif this method is a default method and returns- falseotherwise
- Since:
- 1.8
 
- 
getThrownTypesList<? extends TypeMirror> getThrownTypes()Returns the exceptions and other throwables listed in this method or constructor'sthrowsclause in declaration order.- Returns:
- the exceptions and other throwables listed in the
 throwsclause, or an empty list if there are none
 
- 
getDefaultValueAnnotationValue getDefaultValue()Returns the default value if this executable is an annotation interface element. Returnsnullif this method is not an annotation interface element, or if it is an annotation interface element with no default value.- Returns:
- the default value, or nullif none
 
- 
getEnclosingElementElement getEnclosingElement()Returns the class or interface defining the executable.- Specified by:
- getEnclosingElementin interface- Element
- Returns:
- the class or interface defining the executable
- See Also:
 
- 
getSimpleNameName getSimpleName()Returns the simple name of a constructor, method, or initializer. For a constructor, the name"<init>"is returned, for a static initializer, the name"<clinit>"is returned, and for an anonymous class or instance initializer, an empty name is returned.- Specified by:
- getSimpleNamein interface- Element
- Returns:
- the simple name of a constructor, method, or initializer
- See Also:
 
 
-