Package spoon.reflect.factory
Class AnnotationFactory
java.lang.Object
spoon.reflect.factory.SubFactory
spoon.reflect.factory.TypeFactory
spoon.reflect.factory.AnnotationFactory
The
CtAnnotationType
sub-factory.-
Field Summary
Fields inherited from class spoon.reflect.factory.TypeFactory
BOOLEAN, BOOLEAN_PRIMITIVE, BYTE, BYTE_PRIMITIVE, CHARACTER, CHARACTER_PRIMITIVE, COLLECTION, DATE, DOUBLE, DOUBLE_PRIMITIVE, ENUM, FLOAT, FLOAT_PRIMITIVE, INTEGER, INTEGER_PRIMITIVE, ITERABLE, LIST, LONG, LONG_PRIMITIVE, MAP, NULL_TYPE, OBJECT, OMITTED_TYPE_ARG_TYPE, SET, SHORT, SHORT_PRIMITIVE, STRING, VOID, VOID_PRIMITIVE
Fields inherited from class spoon.reflect.factory.SubFactory
factory
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<A extends Annotation>
CtAnnotation<A>Adds an annotation to an element.<A extends Annotation>
CtAnnotation<A>Creates/updates an element's annotation value.<A extends Annotation>
CtAnnotation<A>annotate(CtElement element, CtTypeReference<A> annotationType)
Adds an annotation to an element.<A extends Annotation>
CtAnnotation<A>annotate(CtElement element, CtTypeReference<A> annotationType, String annotationElementName, Object value)
Creates/updates an element's annotation value.Creates an annotation type.<T extends Annotation>
CtAnnotationType<?>Creates an annotation type.<T extends Annotation>
CtType<T>getAnnotationType(String qualifiedName)
Gets a annotation type from its name.Methods inherited from class spoon.reflect.factory.TypeFactory
booleanPrimitiveType, booleanType, bytePrimitiveType, byteType, characterPrimitiveType, characterType, createArrayReference, createArrayReference, createArrayReference, createArrayReference, createImport, createIntersectionTypeReferenceWithBounds, createReference, createReference, createReference, createReference, createReference, createReference, createReferences, createSimplyQualifiedReference, createTypeAdapter, createTypeMemberWildcardImportReference, createTypeParameterReference, createUnresolvedImport, dateType, doublePrimitiveType, doubleType, floatPrimitiveType, floatType, get, get, getAll, getAll, getDeclaringTypeName, getDefaultBoundingType, getPackageName, getSimpleName, hasInnerType, hasPackage, integerPrimitiveType, integerType, longPrimitiveType, longType, nullType, objectType, shortPrimitiveType, shortType, stringType, voidPrimitiveType, voidType
-
Constructor Details
-
AnnotationFactory
Creates an annotation sub-factory.- Parameters:
factory
- the parent factory
-
-
Method Details
-
create
Creates an annotation type.- Parameters:
owner
- the package of the annotation typesimpleName
- the name of annotation
-
create
Creates an annotation type.- Parameters:
qualifiedName
- the fully qualified name of the annotation type.
-
getAnnotationType
Gets a annotation type from its name. -
annotate
public <A extends Annotation> CtAnnotation<A> annotate(CtElement element, Class<A> annotationType, String annotationElementName, Object value)Creates/updates an element's annotation value.- Parameters:
element
- the program element to annotateannotationType
- the annotation typeannotationElementName
- the annotation element namevalue
- the value of the annotation element- Returns:
- the created/updated annotation
-
annotate
public <A extends Annotation> CtAnnotation<A> annotate(CtElement element, CtTypeReference<A> annotationType, String annotationElementName, Object value)Creates/updates an element's annotation value.- Parameters:
element
- the program element to annotateannotationType
- the annotation typeannotationElementName
- the annotation element namevalue
- the value of the annotation element- Returns:
- the created/updated annotation
-
annotate
Adds an annotation to an element.- Parameters:
element
- the program element to annotateannotationType
- the annotation type- Returns:
- the concerned annotation
-
annotate
public <A extends Annotation> CtAnnotation<A> annotate(CtElement element, CtTypeReference<A> annotationType)Adds an annotation to an element.- Parameters:
element
- the program element to annotateannotationType
- the annotation type- Returns:
- the concerned annotation
-