Method Detail

getActualAnnotation

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.

getAnnotationType

getValue

Gets a value, as a CtExpression, for a given key without any conversion.
If you need the actual value (eg an integer and not a literal, see getValueAsObject(String) and similar methods.
Note that this value type does not necessarily corresponds to the annotation
type member. For example, in case the annotation type expect an array of Object,
and a single value is given, Spoon will return only the object without the CtNewArray.
If you want to get a type closer to the annotation type one, see getWrappedValue(String).

getValueAsString

getWrappedValue

Gets a value for a given key and try to fix its type based on the
annotation type. For example, if the annotation type member expects an array of String,
and it can be resolved, this method will return a CtNewArray instead of a CtLiteral.
Warning: the returned element might be detached from the model

Parameters:

key - Name of searched value.

Returns:

the value expression or null if not found.

getValues

Returns this annotation's elements and their values. This is returned in
the form of a map that associates element names with their corresponding
values. If you iterate over the map with entrySet(), the iteration order
complies with the order of annotation values in the source code.

Returns:

this annotation's element names and their values, or an empty map
if there are none

clone

Clone the element which calls this method in a new object.
Note that that references are kept as is, and thus, so if you clone whole classes
or methods, some parts of the cloned element (eg executable references) may still point to the initial element.
In this case, consider using methods Refactoring.copyType(CtType) and Refactoring.copyMethod(CtMethod) instead which does additional work beyond cloning.