Interface ExecutableElement
- All Superinterfaces:
- AnnotatedConstruct, Element, Parameterizable
public interface ExecutableElement extends Element, Parameterizable
Represents a method, constructor, or initializer (static or instance) of a class or interface, including annotation type elements.
- Since:
- 1.6
- See Also:
ExecutableType
Methods
| Modifier and Type | Method and Description |
|---|---|
AnnotationValue |
getDefaultValue() Returns the default value if this executable is an annotation type element. |
List<? extends VariableElement> |
getParameters() Returns the formal parameters of this executable. |
TypeMirror |
getReceiverType() Returns the receiver type of this executable, or |
TypeMirror |
getReturnType() Returns the return type of this executable. |
Name |
getSimpleName() Returns the simple name of a constructor, method, or initializer. |
List<? extends TypeMirror> |
getThrownTypes() Returns the exceptions and other throwables listed in this method or constructor's |
List<? extends TypeParameterElement> |
getTypeParameters() Returns the formal type parameters of this executable in declaration order. |
boolean |
isDefault() Returns |
boolean |
isVarArgs() Returns |
Methods inherited from interface javax.lang.model.element.Element
accept, asType, equals, getAnnotation, getAnnotationMirrors, getEnclosedElements, getEnclosingElement, getKind, getModifiers, hashCode Methods inherited from interface javax.lang.model.AnnotatedConstruct
getAnnotationsByType Methods
getTypeParameters
List<? extends TypeParameterElement> getTypeParameters()
Returns the formal type parameters of this executable in declaration order.
- Specified by:
-
getTypeParametersin interfaceParameterizable - Returns:
- the formal type parameters, or an empty list if there are none
getReturnType
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:
- the return type of this executable
getParameters
List<? 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
getReceiverType
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.
- Returns:
- the receiver type of this executable
- Since:
- 1.8
isVarArgs
boolean isVarArgs()
Returns true if this method or constructor accepts a variable number of arguments and returns false otherwise.
- Returns:
-
trueif this method or constructor accepts a variable number of arguments andfalseotherwise
isDefault
boolean isDefault()
Returns true if this method is a default method and returns false otherwise.
- Returns:
-
trueif this method is a default method andfalseotherwise - Since:
- 1.8
getThrownTypes
List<? extends TypeMirror> getThrownTypes()
Returns the exceptions and other throwables listed in this method or constructor's throws clause in declaration order.
- Returns:
- the exceptions and other throwables listed in the
throwsclause, or an empty list if there are none
getDefaultValue
AnnotationValue getDefaultValue()
Returns the default value if this executable is an annotation type element. Returns null if this method is not an annotation type element, or if it is an annotation type element with no default value.
- Returns:
- the default value, or
nullif none
getSimpleName
Name 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 interfaceElement - Returns:
- the simple name of a constructor, method, or initializer
- See Also:
-
PackageElement.getSimpleName(),getSimpleName(),TypeElement.getSimpleName(),VariableElement.getSimpleName()
© 1993, 2020, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/javase/8/docs/api/javax/lang/model/element/ExecutableElement.html