Modifier and Type | Method and Description |
---|---|
static TypeElement |
enclosingClass(@Nullable Element elem)
Returns the innermost type element enclosing the given element
|
static PackageElement |
enclosingPackage(@Nullable Element elem)
Returns the innermost package element enclosing the given element.
|
static VariableElement |
findFieldInType(TypeElement type,
@ReadOnly String name)
Returns the field of the class
|
static Set<VariableElement> |
findFieldsInType(TypeElement type,
Collection<@ReadOnly String> names) |
static @Nullable Name |
getQualifiedClassName(@Nullable Element element)
Returns the qualified name of the inner most class enclosing
the provided
Element |
static Set<TypeElement> |
getSuperTypes(TypeElement type)
Determine all type elements for the classes and interfaces referenced
in the extends/implements clauses of the given type element.
|
static TypeMirror |
getType(@Nullable Element element)
Returns the
TypeMirror for usage of Element as a value. |
static @ReadOnly String |
getVerboseName(@Nullable Element elt)
Returns a verbose name that identifies the element.
|
static boolean |
hasReceiver(@Nullable Element element)
Does the given element need a receiver for accesses?
For example, an access to a local variable does not require a receiver.
|
static boolean |
isCompileTimeConstant(@Nullable Element elt)
Returns true if the element is a constant time reference
|
static boolean |
isError(@Nullable Element element) |
static boolean |
isFinal(@Nullable Element element)
Returns true if the element is a final element: a final field, final
method, or final class
|
static boolean |
isObject(TypeElement element)
Check if the element is an element for 'java.lang.Object'
|
static boolean |
isStatic(@Nullable Element element)
Returns true if the element is a static element: whether it is a static
field, static method, or static class
|
public static TypeElement enclosingClass(@Nullable Element elem)
elem
- the enclosed element of a classpublic static PackageElement enclosingPackage(@Nullable Element elem)
Elements.getPackageOf(Element)
.elem
- the enclosed element of a packagepublic static boolean isStatic(@Nullable Element element)
element
- public static boolean isFinal(@Nullable Element element)
element
- public static TypeMirror getType(@Nullable Element element)
TypeMirror
for usage of Element as a value. It
returns the return type of a method element, the class type of a
constructor, or simply the type mirror of the element itself.element
- public static @Nullable Name getQualifiedClassName(@Nullable Element element)
Element
element
- an element enclosed by a class, or a
TypeElement
Name
of the innermost class
enclosing the elementpublic static @ReadOnly String getVerboseName(@Nullable Element elt)
public static boolean isObject(TypeElement element)
element
- the type elementpublic static boolean isCompileTimeConstant(@Nullable Element elt)
public static VariableElement findFieldInType(TypeElement type, @ReadOnly String name)
public static Set<VariableElement> findFieldsInType(TypeElement type, Collection<@ReadOnly String> names)
public static boolean hasReceiver(@Nullable Element element)
element
- The element to test.public static Set<TypeElement> getSuperTypes(TypeElement type)