Package serp.bytecode
Class Annotation
- java.lang.Object
-
- serp.bytecode.Annotation
-
- All Implemented Interfaces:
BCEntity,VisitAcceptor
public class Annotation extends java.lang.Object implements BCEntity, VisitAcceptor
A declared annotation.- Author:
- Abe White
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAnnotation.PropertyAn annotation property.
-
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.Annotation.PropertyaddProperty(java.lang.String name)Add a new property.Annotation.PropertyaddProperty(Annotation.Property p)Import a property from another instance.voidclearProperties()Clear all annotation properties.java.lang.ClassLoadergetClassLoader()Return the class loader to use when loading related classes.BCEntitygetOwner()Annotations are stored in anAnnotationstable or as part of anAnnotationproperty value.ConstantPoolgetPool()Return the constant pool of the current class.ProjectgetProject()Return the project of the current class.Annotation.Property[]getProperties()All declared properties.Annotation.PropertygetProperty(java.lang.String name)Return the property with the given name, or null if none.java.lang.ClassgetType()TheClassobject for this annotation's type.BCClassgetTypeBC()The bytecode for the type of this annotation.intgetTypeIndex()The index in the classConstantPoolof theUTF8Entryholding the type of this annotation.java.lang.StringgetTypeName()The name of this annotation's type.booleanisValid()Return false if this entity has been removed from its parent; in this case the results of any operations on the entity are undefined.booleanremoveProperty(java.lang.String name)Remove the property with the given name.booleanremoveProperty(Annotation.Property prop)Remove the given property.voidsetProperties(Annotation.Property[] props)Set the annotation properties.voidsetType(java.lang.Class type)This annotation's type.voidsetType(java.lang.String type)This annotation's type.voidsetType(BCClass type)This annotation's type.voidsetTypeIndex(int index)The index in the classConstantPoolof theUTF8Entryholding the type of this annotation.
-
-
-
Method Detail
-
getOwner
public BCEntity getOwner()
Annotations are stored in anAnnotationstable or as part of anAnnotationproperty value.
-
getTypeIndex
public int getTypeIndex()
The index in the classConstantPoolof theUTF8Entryholding the type of this annotation.
-
setTypeIndex
public void setTypeIndex(int index)
The index in the classConstantPoolof theUTF8Entryholding the type of this annotation.
-
getTypeName
public java.lang.String getTypeName()
The name of this annotation's type.
-
getType
public java.lang.Class getType()
TheClassobject for this annotation's type.
-
getTypeBC
public BCClass getTypeBC()
The bytecode for the type of this annotation.
-
setType
public void setType(java.lang.String type)
This annotation's type.
-
setType
public void setType(java.lang.Class type)
This annotation's type.
-
setType
public void setType(BCClass type)
This annotation's type.
-
getProperties
public Annotation.Property[] getProperties()
All declared properties.
-
setProperties
public void setProperties(Annotation.Property[] props)
Set the annotation properties. This method is useful when importing properties from another instance.
-
getProperty
public Annotation.Property getProperty(java.lang.String name)
Return the property with the given name, or null if none.
-
addProperty
public Annotation.Property addProperty(Annotation.Property p)
Import a property from another instance.- Returns:
- the newly added property
-
addProperty
public Annotation.Property addProperty(java.lang.String name)
Add a new property.
-
clearProperties
public void clearProperties()
Clear all annotation properties.
-
removeProperty
public boolean removeProperty(Annotation.Property prop)
Remove the given property.- Returns:
- true if an property was removed, false otherwise
-
removeProperty
public boolean removeProperty(java.lang.String name)
Remove the property with the given name.- Returns:
- true if a property was removed, false otherwise
-
getProject
public Project getProject()
Description copied from interface:BCEntityReturn the project of the current class.- Specified by:
getProjectin interfaceBCEntity
-
getPool
public ConstantPool getPool()
Description copied from interface:BCEntityReturn the constant pool of the current class.
-
getClassLoader
public java.lang.ClassLoader getClassLoader()
Description copied from interface:BCEntityReturn the class loader to use when loading related classes.- Specified by:
getClassLoaderin interfaceBCEntity
-
isValid
public boolean isValid()
Description copied from interface:BCEntityReturn false if this entity has been removed from its parent; in this case the results of any operations on the entity are undefined.
-
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.- Specified by:
acceptVisitin interfaceVisitAcceptor
-
-