Interface AnnotationTargetSource<O extends JavaSource<O>,T>
- All Superinterfaces:
AnnotationTarget<O>,Internal,Origin<O>
- All Known Subinterfaces:
AnnotationElementSource,EnumConstantSource,EnumConstantSource.Body,FieldSource<O>,JavaAnnotationSource,JavaClassSource,JavaEnumSource,JavaInterfaceSource,JavaPackageInfoSource,JavaRecordComponentSource,JavaRecordSource,JavaSource<T>,MemberSource<O,,T> MethodSource<O>,ParameterSource<O>
Represents a Java source element that may carry annotations.
- Author:
- Lincoln Baxter, III
-
Method Summary
Modifier and TypeMethodDescriptionAdd a new annotation instance to thisAnnotationTargetSource(note that an import statement must be added manually if required).addAnnotation(Class<? extends Annotation> type) Add a new annotation instance to thisAnnotationTargetSource, using the givenClassas the annotation type.addAnnotation(String className) Add a new annotation instance to thisAnnotationTargetSource, using the givenStringclassName as the annotation type.getAnnotation(Class<? extends Annotation> type) Returns the annotation bound of the given type in thisAnnotationTargetor null if it doesn't existgetAnnotation(String type) Returns the annotation bound of the given type in thisAnnotationTargetor null if it doesn't existvoidRemove all annotations instance from thisAnnotationTargetSource.removeAnnotation(Annotation<O> annotation) Remove an annotation instance from thisAnnotationTargetSource.Methods inherited from interface org.jboss.forge.roaster.model.AnnotationTarget
hasAnnotation, hasAnnotationMethods inherited from interface org.jboss.forge.roaster.Internal
getInternal
-
Method Details
-
getAnnotations
List<AnnotationSource<O>> getAnnotations()Description copied from interface:AnnotationTarget- Specified by:
getAnnotationsin interfaceAnnotationTarget<O extends JavaSource<O>>
-
getAnnotation
Description copied from interface:AnnotationTargetReturns the annotation bound of the given type in thisAnnotationTargetor null if it doesn't exist- Specified by:
getAnnotationin interfaceAnnotationTarget<O extends JavaSource<O>>- Parameters:
type- TheAnnotationtype
-
getAnnotation
Description copied from interface:AnnotationTargetReturns the annotation bound of the given type in thisAnnotationTargetor null if it doesn't exist- Specified by:
getAnnotationin interfaceAnnotationTarget<O extends JavaSource<O>>- Parameters:
type- The FQN of the annotation
-
addAnnotation
AnnotationSource<O> addAnnotation()Add a new annotation instance to thisAnnotationTargetSource(note that an import statement must be added manually if required). -
addAnnotation
Add a new annotation instance to thisAnnotationTargetSource, using the givenClassas the annotation type. Attempt to add an import statement to this object'sAnnotationTargetSourceif required. -
addAnnotation
Add a new annotation instance to thisAnnotationTargetSource, using the givenStringclassName as the annotation type. Attempt to add an import statement to this object'sAnnotationTargetSourceif required (note that the given className must be fully-qualified in order to properly import required classes). -
removeAnnotation
Remove an annotation instance from thisAnnotationTargetSource. -
removeAllAnnotations
void removeAllAnnotations()Remove all annotations instance from thisAnnotationTargetSource.
-