Uses of Interface
javax.lang.model.element.Element
Package
Description
Provides interfaces to represent source code as abstract syntax
trees (AST).
Provides utilities for operations on abstract syntax trees (AST).
Facilities for declaring annotation processors and for
allowing annotation processors to communicate with an annotation processing
tool environment.
Interfaces used to model elements of the Java programming language.
Interfaces used to model Java programming language types.
Utilities to assist in the processing of
program elements and
types.
The Doclet API provides an environment which, in conjunction with
the Language Model API and Compiler Tree API, allows clients
to inspect the source-level structures of programs and
libraries, including API comments embedded in the source.
-
Uses of Element in com.sun.source.tree
Modifier and TypeMethodDescriptionScope.getLocalElements()
Returns the elements directly contained in this scope. -
Uses of Element in com.sun.source.util
Modifier and TypeMethodDescriptionabstract Element
DocTrees.getElement
(DocTreePath path) Returns the language model element referred to by the leaf node of the givenDocTreePath
, ornull
if unknown.abstract Element
Trees.getElement
(TreePath path) Returns theElement
for theTree
node identified by a givenTreePath
.Modifier and TypeMethodDescriptionabstract DocCommentTree
DocTrees.getDocCommentTree
(Element e) Returns the doc comment tree of the given element.abstract DocCommentTree
DocTrees.getDocCommentTree
(Element e, String relativePath) Returns the doc comment tree of the given file, which must be of one of the supported file types, and whose path is specified relative to the given element.abstract TreePath
Returns theTreePath
node for a givenElement
.abstract TreePath
Trees.getPath
(Element e, AnnotationMirror a) Returns theTreePath
node for anAnnotationMirror
on a givenElement
.abstract TreePath
Trees.getPath
(Element e, AnnotationMirror a, AnnotationValue v) Returns theTreePath
node for anAnnotationValue
for anAnnotationMirror
on a givenElement
.abstract Tree
Returns theTree
node for a givenElement
.abstract Tree
Trees.getTree
(Element e, AnnotationMirror a) Returns theTree
node for anAnnotationMirror
on a givenElement
.abstract Tree
Trees.getTree
(Element e, AnnotationMirror a, AnnotationValue v) Returns theTree
node for anAnnotationValue
for anAnnotationMirror
on a givenElement
.abstract boolean
Trees.isAccessible
(Scope scope, Element member, DeclaredType type) Checks whether the given element is accessible as a member of the given type in a given scope. -
Uses of Element in javax.annotation.processing
Modifier and TypeMethodDescriptionRoundEnvironment.getElementsAnnotatedWith
(Class<? extends Annotation> a) Returns the elements annotated with the given annotation interface.RoundEnvironment.getElementsAnnotatedWith
(TypeElement a) Returns the elements annotated with the given annotation interface.RoundEnvironment.getElementsAnnotatedWithAny
(Set<Class<? extends Annotation>> annotations) Returns the elements annotated with one or more of the given annotation interfaces.RoundEnvironment.getElementsAnnotatedWithAny
(TypeElement... annotations) Returns the elements annotated with one or more of the given annotation interfaces.RoundEnvironment.getRootElements()
Returns the root elements for annotation processing generated by the prior round.Modifier and TypeMethodDescriptionFiler.createClassFile
(CharSequence name, Element... originatingElements) Creates a new class file, and returns an object to allow writing to it.Filer.createResource
(JavaFileManager.Location location, CharSequence moduleAndPkg, CharSequence relativeName, Element... originatingElements) Creates a new auxiliary resource file for writing and returns a file object for it.Filer.createSourceFile
(CharSequence name, Element... originatingElements) Creates a new source file and returns an object to allow writing to it.Iterable
<? extends Completion> AbstractProcessor.getCompletions
(Element element, AnnotationMirror annotation, ExecutableElement member, String userText) Returns an empty iterable of completions.Iterable
<? extends Completion> Processor.getCompletions
(Element element, AnnotationMirror annotation, ExecutableElement member, String userText) Returns to the tool infrastructure an iterable of suggested completions to an annotation.default void
Messager.printError
(CharSequence msg, Element e) Prints an error at the location of the element.void
Messager.printMessage
(Diagnostic.Kind kind, CharSequence msg, Element e) Prints a message of the specified kind at the location of the element.void
Messager.printMessage
(Diagnostic.Kind kind, CharSequence msg, Element e, AnnotationMirror a) Prints a message of the specified kind at the location of the annotation mirror of the annotated element.void
Messager.printMessage
(Diagnostic.Kind kind, CharSequence msg, Element e, AnnotationMirror a, AnnotationValue v) Prints a message of the specified kind at the location of the annotation value inside the annotation mirror of the annotated element.default void
Messager.printNote
(CharSequence msg, Element e) Prints a note at the location of the element.default void
Messager.printWarning
(CharSequence msg, Element e) Prints a warning at the location of the element. -
Uses of Element in javax.lang.model.element
Modifier and TypeInterfaceDescriptioninterface
Represents a method, constructor, or initializer (static or instance) of a class or interface, including annotation interface elements.interface
Represents a module program element.interface
Represents a package program element.interface
A mixin interface for an element that has type parameters.interface
A mixin interface for an element that has a qualified name.interface
Represents a record component.interface
Represents a class or interface program element.interface
Represents a formal type parameter of a generic class, interface, method, or constructor element.interface
Represents a field,enum
constant, method or constructor parameter, local variable, resource variable, or exception parameter.Modifier and TypeMethodDescriptionElement.getEnclosingElement()
Returns the innermost element within which this element is, loosely speaking, enclosed.ExecutableElement.getEnclosingElement()
Returns the class or interface defining the executable.ModuleElement.getEnclosingElement()
Returnsnull
since a module is not enclosed by another element.PackageElement.getEnclosingElement()
Returns the enclosing module if such a module exists; otherwisenull
.RecordComponentElement.getEnclosingElement()
Returns the enclosing element of this record component.TypeElement.getEnclosingElement()
Returns the package of a top-level class or interface and returns the immediately lexically enclosing element for a nested class or interface.TypeParameterElement.getEnclosingElement()
Returns the generic element of this type parameter.VariableElement.getEnclosingElement()
Returns the enclosing element of this variable.TypeParameterElement.getGenericElement()
Returns the generic class, interface, method, or constructor that is parameterized by this type parameter.UnknownElementException.getUnknownElement()
Returns the unknown element.Modifier and TypeMethodDescriptionElement.getEnclosedElements()
Returns the elements that are, loosely speaking, directly enclosed by this element.ModuleElement.getEnclosedElements()
Returns the packages within this module.PackageElement.getEnclosedElements()
Returns the top-level classes and interfaces within this package.TypeElement.getEnclosedElements()
Returns the fields, methods, constructors, record components, and member classes and interfaces that are directly declared in this class or interface.Modifier and TypeMethodDescriptiondefault R
A convenience method equivalent tovisit(e, null)
.Visits an element.ElementVisitor.visitUnknown
(Element e, P p) Visits an unknown kind of element.ModifierConstructorDescriptionCreates a newUnknownElementException
. -
Uses of Element in javax.lang.model.type
-
Uses of Element in javax.lang.model.util
Modifier and TypeMethodDescriptionTypes.asElement
(TypeMirror t) Returns the element corresponding to a type.Modifier and TypeMethodDescriptionElements.getAllMembers
(TypeElement type) Returns all members of a type element, whether inherited or declared directly.Modifier and TypeMethodDescriptionTypes.asMemberOf
(DeclaredType containing, Element element) Returns the type of an element when that element is viewed as a member of, or otherwise directly contained by, a given type.protected R
SimpleElementVisitor6.defaultAction
(Element e, P p) The default action for visit methods.List
<? extends AnnotationMirror> Elements.getAllAnnotationMirrors
(Element e) Returns all annotations present on an element, whether directly present or present via inheritance.Elements.getDocComment
(Element e) Returns the text of the documentation ("JavaDoc") comment of an element.default Elements.DocCommentKind
Elements.getDocCommentKind
(Element e) Returns the kind of the documentation comment for the given element, ornull
if there is no comment or the kind is not known.default JavaFileObject
Elements.getFileObjectOf
(Element e) Returns the file object for this element ornull
if there is no such file object.default ModuleElement
Elements.getModuleOf
(Element e) Returns the module of an element.default Elements.Origin
Returns the origin of the given element.default TypeElement
Elements.getOutermostTypeElement
(Element e) Returns the outermost type element an element is contained in if such a containing element exists; otherwise returnsnull
.Elements.getPackageOf
(Element e) Returns the package of an element.boolean
Tests whether one type, method, or field hides another.boolean
Elements.isDeprecated
(Element e) Returnstrue
if the element is deprecated,false
otherwise.void
Elements.printElements
(Writer w, Element... elements) Prints a representation of the elements to the given writer in the specified order.final R
Convenience method equivalent tov.scan(e, null)
.Processes an element by callinge.accept(this, p)
; this method may be overridden by subclasses.final R
Visits any program element as if by passing itself to that element'saccept
method and passingnull
for the additional parameter.final R
Visits any program element as if by passing itself to that element'saccept
method.AbstractElementVisitor6.visitUnknown
(Element e, P p) Visits an unknown kind of element.Modifier and TypeMethodDescriptionstatic List
<ExecutableElement> ElementFilter.constructorsIn
(Iterable<? extends Element> elements) Returns a list of constructors inelements
.static Set
<ExecutableElement> ElementFilter.constructorsIn
(Set<? extends Element> elements) Returns a set of constructors inelements
.static List
<VariableElement> Returns a list of fields inelements
.static Set
<VariableElement> Returns a set of fields inelements
.static List
<ExecutableElement> Returns a list of methods inelements
.static Set
<ExecutableElement> Returns a set of methods inelements
.static List
<ModuleElement> Returns a list of modules inelements
.static Set
<ModuleElement> Returns a set of modules inelements
.static List
<PackageElement> ElementFilter.packagesIn
(Iterable<? extends Element> elements) Returns a list of packages inelements
.static Set
<PackageElement> ElementFilter.packagesIn
(Set<? extends Element> elements) Returns a set of packages inelements
.static List
<RecordComponentElement> ElementFilter.recordComponentsIn
(Iterable<? extends Element> elements) Returns a list of record components inelements
.static Set
<RecordComponentElement> ElementFilter.recordComponentsIn
(Set<? extends Element> elements) Returns a set of record components inelements
.final R
Iterates over the given elements and callsscan(Element, P)
on each one.static List
<TypeElement> Returns a list of classes and interfaces inelements
.static Set
<TypeElement> Returns a set of classes and interfaces inelements
. -
Uses of Element in jdk.javadoc.doclet
Modifier and TypeMethodDescriptionDocletEnvironment.getIncludedElements()
Returns the module, package and type elements that should be included in the documentation.DocletEnvironment.getSpecifiedElements()
Returns the elements specified when the tool is invoked.Modifier and TypeMethodDescriptionboolean
DocletEnvironment.isIncluded
(Element e) Returns true if an element should be included in the documentation.boolean
DocletEnvironment.isSelected
(Element e) Returns true if the element is selected.void
Reporter.print
(Diagnostic.Kind kind, Element element, String message) Prints a diagnostic message related to an element.Returns the string representation of a series of instances of this tag to be included in the generated output.