Package serp.bytecode
Class Annotations
- java.lang.Object
-
- serp.bytecode.Attributes
-
- serp.bytecode.Attribute
-
- serp.bytecode.Annotations
-
- All Implemented Interfaces:
BCEntity,VisitAcceptor
public class Annotations extends Attribute
Java annotation data.- Author:
- Abe White
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidacceptVisit(BCVisitor visit)Accept a visit from aBCVisitor, calling the appropriate methods to notify the visitor that it has entered this entity, and to provide it with the proper callbacks for each sub-entity owned by this one.AnnotationaddAnnotation(java.lang.Class type)Add a new annotation.AnnotationaddAnnotation(java.lang.String type)Add a new annotation.AnnotationaddAnnotation(Annotation an)Import an annotation from another instance.AnnotationaddAnnotation(BCClass type)Add a new annotation.voidclear()Remove all annotations.AnnotationgetAnnotation(java.lang.Class type)Return the annotation of the given type, or null if none.AnnotationgetAnnotation(java.lang.String type)Return the annotation of the given type, or null if none.AnnotationgetAnnotation(BCClass type)Return the annotation of the given type, or null if none.Annotation[]getAnnotations()All declared annotations.booleanisRuntime()Whether these annotations are runtime-visible.booleanremoveAnnotation(java.lang.Class type)Remove the annotation of the given type.booleanremoveAnnotation(java.lang.String type)Remove the annotation of the given type.booleanremoveAnnotation(Annotation anno)Remove the given annotation.booleanremoveAnnotation(BCClass type)Remove the annotation of the given type.voidsetAnnotations(Annotation[] annos)Set the annotations.-
Methods inherited from class serp.bytecode.Attribute
getClassLoader, getName, getNameIndex, getOwner, getPool, getProject, isValid
-
Methods inherited from class serp.bytecode.Attributes
addAttribute, addAttribute, clearAttributes, getAttribute, getAttributes, getAttributes, removeAttribute, removeAttribute, setAttributes
-
-
-
-
Method Detail
-
isRuntime
public boolean isRuntime()
Whether these annotations are runtime-visible.
-
getAnnotations
public Annotation[] getAnnotations()
All declared annotations.
-
setAnnotations
public void setAnnotations(Annotation[] annos)
Set the annotations. This method is useful when importing annotations from another instance.
-
getAnnotation
public Annotation getAnnotation(java.lang.Class type)
Return the annotation of the given type, or null if none.
-
getAnnotation
public Annotation getAnnotation(BCClass type)
Return the annotation of the given type, or null if none.
-
getAnnotation
public Annotation getAnnotation(java.lang.String type)
Return the annotation of the given type, or null if none.
-
addAnnotation
public Annotation addAnnotation(Annotation an)
Import an annotation from another instance.- Returns:
- the newly added annotation
-
addAnnotation
public Annotation addAnnotation(java.lang.Class type)
Add a new annotation.
-
addAnnotation
public Annotation addAnnotation(BCClass type)
Add a new annotation.
-
addAnnotation
public Annotation addAnnotation(java.lang.String type)
Add a new annotation.
-
clear
public void clear()
Remove all annotations.
-
removeAnnotation
public boolean removeAnnotation(Annotation anno)
Remove the given annotation.- Returns:
- true if an annotation was removed, false otherwise
-
removeAnnotation
public boolean removeAnnotation(java.lang.Class type)
Remove the annotation of the given type.- Returns:
- true if an annotation was removed, false otherwise
-
removeAnnotation
public boolean removeAnnotation(BCClass type)
Remove the annotation of the given type.- Returns:
- true if an annotation was removed, false otherwise
-
removeAnnotation
public boolean removeAnnotation(java.lang.String type)
Remove the annotation of the given type.- Returns:
- true if an annotation was removed, false otherwise
-
acceptVisit
public void acceptVisit(BCVisitor visit)
Description copied from interface:VisitAcceptorAccept a visit from aBCVisitor, calling the appropriate methods to notify the visitor that it has entered this entity, and to provide it with the proper callbacks for each sub-entity owned by this one.
-
-