public final class AnnotationMirrors extends Object
AnnotationMirror
instances.Modifier and Type | Method and Description |
---|---|
static com.google.common.base.Equivalence<AnnotationMirror> |
equivalence()
Returns an
Equivalence for AnnotationMirror as some implementations
delegate equality tests to Object.equals(java.lang.Object) whereas the documentation explicitly
states that instance/reference equality is not the proper test. |
static com.google.common.collect.ImmutableSet<? extends AnnotationMirror> |
getAnnotatedAnnotations(Element element,
Class<? extends Annotation> annotationType)
Returns all annotations that are present on the given
Element which are themselves annotated with annotationType . |
static Map.Entry<ExecutableElement,AnnotationValue> |
getAnnotationElementAndValue(AnnotationMirror annotationMirror,
String elementName)
Returns a
ExecutableElement and its associated AnnotationValue if such
an element was either declared in the usage represented by the provided
AnnotationMirror , or if such an element was defined with a default. |
static AnnotationValue |
getAnnotationValue(AnnotationMirror annotationMirror,
String elementName)
Returns an
AnnotationValue for the named element if such an element was
either declared in the usage represented by the provided AnnotationMirror , or if
such an element was defined with a default. |
static Map<ExecutableElement,AnnotationValue> |
getAnnotationValuesWithDefaults(AnnotationMirror annotation)
Returns the
AnnotationMirror 's map of AnnotationValue indexed by
ExecutableElement , supplying default values from the annotation if the
annotation property has not been set. |
public static com.google.common.base.Equivalence<AnnotationMirror> equivalence()
Equivalence
for AnnotationMirror
as some implementations
delegate equality tests to Object.equals(java.lang.Object)
whereas the documentation explicitly
states that instance/reference equality is not the proper test.public static Map<ExecutableElement,AnnotationValue> getAnnotationValuesWithDefaults(AnnotationMirror annotation)
AnnotationMirror
's map of AnnotationValue
indexed by
ExecutableElement
, supplying default values from the annotation if the
annotation property has not been set. This is equivalent to
Elements.getElementValuesWithDefaults(AnnotationMirror)
but can be called
statically without an Elements
instance.public static AnnotationValue getAnnotationValue(AnnotationMirror annotationMirror, String elementName)
AnnotationValue
for the named element if such an element was
either declared in the usage represented by the provided AnnotationMirror
, or if
such an element was defined with a default.IllegalArgumentException
- if no element is defined with the given elementName.public static Map.Entry<ExecutableElement,AnnotationValue> getAnnotationElementAndValue(AnnotationMirror annotationMirror, String elementName)
ExecutableElement
and its associated AnnotationValue
if such
an element was either declared in the usage represented by the provided
AnnotationMirror
, or if such an element was defined with a default.IllegalArgumentException
- if no element is defined with the given elementName.public static com.google.common.collect.ImmutableSet<? extends AnnotationMirror> getAnnotatedAnnotations(Element element, Class<? extends Annotation> annotationType)
Element
which are themselves annotated with annotationType
.Copyright © 2021. All rights reserved.