APIdia Launch Partner
Top Description Methods
javax.lang.model.element

public Interface ExecutableElement

extends Element, Parameterizable
Imports
java.util.List, javax.lang.model.type.*

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
Java Language Specification
8.4 Method Declarations, 8.6 Instance Initializers, 8.7 Static Initializers, 8.8 Constructor Declarations, 9.4 Method Declarations, 9.6.1 Annotation Interface Elements
See Also
ExecutableType

Method Summary

Modifier and TypeMethod and Description
public TypeMirror

Returns:

the executable type defined by this executable element
asType
()

Redeclares javax.lang.model.element.Element.asType.

Returns the executable type defined by this executable element.

public AnnotationValue

Returns:

the default value, or null if none
getDefaultValue
()

Returns the default value if this executable is an annotation interface element.

public Element

Returns:

the class or interface defining the executable
getEnclosingElement
()

Redeclares javax.lang.model.element.Element.getEnclosingElement.

Returns the class or interface defining the executable.

public List<? extends VariableElement>

Returns:

the formal parameters, or an empty list if there are none
getParameters
()

Returns the formal parameters of this executable.

public TypeMirror

Returns:

the receiver type of this executable
getReceiverType
()

Returns the receiver type of this executable, or NoType with kind NONE if the executable has no receiver type.

public TypeMirror

Returns:

the return type of this executable
getReturnType
()

Returns the return type of this executable.

public Name

Returns:

the simple name of a constructor, method, or initializer
getSimpleName
()

Redeclares javax.lang.model.element.Element.getSimpleName.

Returns the simple name of a constructor, method, or initializer.

public List<? extends TypeMirror>

Returns:

the exceptions and other throwables listed in the throws clause, or an empty list if there are none
getThrownTypes
()

Returns the exceptions and other throwables listed in this method or constructor's throws clause in declaration order.

public List<? extends TypeParameterElement>

Returns:

the formal type parameters, or an empty list if there are none
getTypeParameters
()

Redeclares javax.lang.model.element.Parameterizable.getTypeParameters.

Returns the formal type parameters of this executable in declaration order.

public boolean

Returns:

true if this method is a default method and returns false otherwise
isDefault
()

Returns true if this method is a default method and returns false otherwise.

public boolean

Returns:

true if this method or constructor accepts a variable number of arguments and returns false otherwise
isVarArgs
()

Returns true if this method or constructor accepts a variable number of arguments and returns false otherwise.

Inherited from javax.lang.model.element.Element:
acceptequalsgetAnnotationgetAnnotationMirrorsgetAnnotationsByTypegetEnclosedElementsgetKindgetModifiershashCode

Method Detail

asTypeback to summary
public TypeMirror asType()

Redeclares javax.lang.model.element.Element.asType.

Returns the executable type defined by this executable element.

Returns:TypeMirror

the executable type defined by this executable element

Annotations
@Override
See Also
ExecutableType
getDefaultValueback to summary
public AnnotationValue getDefaultValue()

Returns the default value if this executable is an annotation interface element. Returns null if this method is not an annotation interface element, or if it is an annotation interface element with no default value.

Returns:AnnotationValue

the default value, or null if none

getEnclosingElementback to summary
public Element getEnclosingElement()

Redeclares javax.lang.model.element.Element.getEnclosingElement.

Returns the class or interface defining the executable.

Returns:Element

the class or interface defining the executable

Annotations
@Override
getParametersback to summary
public List<? extends VariableElement> getParameters()

Returns the formal parameters of this executable. They are returned in declaration order.

Returns:List<? extends VariableElement>

the formal parameters, or an empty list if there are none

getReceiverTypeback to summary
public TypeMirror getReceiverType()

Returns the receiver type of this executable, or NoType with kind NONE if 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.

The receiver parameter is a syntactic device added to the language for the purpose of hosting annotations. Even when source code is used as the basis for creating an executable, if a receiver parameter is not present in the source code, an implementation may elect to return a NoType object even in cases where a receiver type is nominally defined on the executable in question, such as an instance method. When a receiver parameter is present and hosting annotations, a suitably annotated receiver type is returned.

Returns:TypeMirror

the receiver type of this executable

Since
1.8
Java Language Specification
8.4 Method Declarations, 8.4.1 Formal Parameters, 8.8 Constructor Declarations
getReturnTypeback to summary
public TypeMirror getReturnType()

Returns the return type of this executable. Returns a NoType with kind VOID if this executable is not a method, or is a method that does not return a value.

Returns:TypeMirror

the return type of this executable

getSimpleNameback to summary
public Name getSimpleName()

Redeclares javax.lang.model.element.Element.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.

Returns:Name

the simple name of a constructor, method, or initializer

Annotations
@Override
getThrownTypesback to summary
public List<? extends TypeMirror> getThrownTypes()

Returns the exceptions and other throwables listed in this method or constructor's throws clause in declaration order.

Returns:List<? extends TypeMirror>

the exceptions and other throwables listed in the throws clause, or an empty list if there are none

getTypeParametersback to summary
public List<? extends TypeParameterElement> getTypeParameters()

Redeclares javax.lang.model.element.Parameterizable.getTypeParameters.

Returns the formal type parameters of this executable in declaration order.

Returns:List<? extends TypeParameterElement>

the formal type parameters, or an empty list if there are none

isDefaultback to summary
public boolean isDefault()

Returns true if this method is a default method and returns false otherwise.

Returns:boolean

true if this method is a default method and returns false otherwise

Since
1.8
isVarArgsback to summary
public boolean isVarArgs()

Returns true if this method or constructor accepts a variable number of arguments and returns false otherwise.

Returns:boolean

true if this method or constructor accepts a variable number of arguments and returns false otherwise