public class CtAnnotationImpl<A extends Annotation> extends CtElementImpl implements CtAnnotation<A>
CtAnnotation
.logger
Constructor and Description |
---|
CtAnnotationImpl() |
Modifier and Type | Method and Description |
---|---|
void |
accept(CtVisitor visitor)
Accepts a visitor.
|
protected void |
appendValues(String elementName,
Object... values) |
A |
getActualAnnotation()
Returns the actual annotation (a dynamic proxy for this element).
|
CtElement |
getAnnotatedElement()
Returns the element which is annotated by this annotation.
|
CtAnnotatedElementType |
getAnnotatedElementType()
Returns the type of the element which is annotated by this annotation.
|
CtTypeReference<A> |
getAnnotationType()
Returns the annotation type of this annotation.
|
<T> T |
getElementValue(String key)
Gets a value for a given key (with conversion if needed).
|
Map<String,Object> |
getElementValues()
Returns this annotation's elements and their values.
|
void |
setAnnotationType(CtTypeReference<? extends Annotation> annotationType)
Sets the annotation's type.
|
void |
setElementValues(Map<String,Object> values)
Set's this annotation's element names and their values.
|
addAnnotation, compareTo, EMPTY_COLLECTION, EMPTY_LIST, EMPTY_SET, equals, getAnnotatedChildren, getAnnotation, getAnnotation, getAnnotations, getDocComment, getElements, getFactory, getParent, getParent, getParentNoExceptions, getPosition, getReferencedTypes, getReferences, getSignature, hashCode, hasParent, isImplicit, isParentInitialized, isRootElement, removeAnnotation, replace, replace, setAnnotations, setDocComment, setFactory, setImplicit, setParent, setPosition, setPositions, setRootElement, toString, updateAllParentsBelow
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAnnotation, getAnnotatedChildren, getAnnotation, getAnnotation, getAnnotations, getDocComment, getElements, getParent, getParent, getPosition, getReferencedTypes, getReferences, getSignature, hasParent, isImplicit, isParentInitialized, isRootElement, removeAnnotation, replace, setAnnotations, setDocComment, setImplicit, setParent, setPosition, setPositions, setRootElement, updateAllParentsBelow
getFactory, setFactory
compareTo
public void accept(CtVisitor visitor)
CtElement
public A getActualAnnotation()
CtAnnotation
NOTE: before using an annotation proxy, you have to make sure that all
the types referenced by the annotation have been compiled and are in the
classpath so that accessed values can be converted into the actual types (CtAnnotation.getElementValue(String)
).
getActualAnnotation
in interface CtAnnotation<A extends Annotation>
public CtTypeReference<A> getAnnotationType()
CtAnnotation
getAnnotationType
in interface CtAnnotation<A extends Annotation>
public <T> T getElementValue(String key)
CtAnnotation
NOTE: in case of a type, the value is converted to the actual type. To
access the type as a reference, use CtAnnotation.getElementValues()
, which
returns a map containing the raw (unconverted) values.
getElementValue
in interface CtAnnotation<A extends Annotation>
key
- name of searched valuepublic Map<String,Object> getElementValues()
CtAnnotation
Note that getElementValue("key")
is not completely similar
to getElementValues().get("key")
since the former converts
type references into the actual types.
getElementValues
in interface CtAnnotation<A extends Annotation>
public void setAnnotationType(CtTypeReference<? extends Annotation> annotationType)
CtAnnotation
setAnnotationType
in interface CtAnnotation<A extends Annotation>
annotationType
- reference to the type of this annotationpublic void setElementValues(Map<String,Object> values)
CtAnnotation
CtTypeReference
.setElementValues
in interface CtAnnotation<A extends Annotation>
public CtElement getAnnotatedElement()
CtAnnotation
getAnnotatedElement
in interface CtAnnotation<A extends Annotation>
CtElement
public CtAnnotatedElementType getAnnotatedElementType()
CtAnnotation
getAnnotatedElementType
in interface CtAnnotation<A extends Annotation>
CtAnnotatedElementType
Copyright © 2007–2014 Inria. All rights reserved.