Package serp.bytecode
Class Annotation
java.lang.Object
serp.bytecode.Annotation
- All Implemented Interfaces:
BCEntity
,VisitAcceptor
A declared annotation.
- Author:
- Abe White
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoid
acceptVisit
(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.addProperty
(String name) Add a new property.Import a property from another instance.void
Clear all annotation properties.Return the class loader to use when loading related classes.getOwner()
Annotations are stored in anAnnotations
table or as part of anAnnotation
property value.getPool()
Return the constant pool of the current class.Return the project of the current class.All declared properties.getProperty
(String name) Return the property with the given name, or null if none.getType()
TheClass
object for this annotation's type.The bytecode for the type of this annotation.int
The index in the classConstantPool
of theUTF8Entry
holding the type of this annotation.The name of this annotation's type.boolean
isValid()
Return false if this entity has been removed from its parent; in this case the results of any operations on the entity are undefined.boolean
removeProperty
(String name) Remove the property with the given name.boolean
Remove the given property.void
setProperties
(Annotation.Property[] props) Set the annotation properties.void
This annotation's type.void
This annotation's type.void
This annotation's type.void
setTypeIndex
(int index) The index in the classConstantPool
of theUTF8Entry
holding the type of this annotation.
-
Method Details
-
getOwner
Annotations are stored in anAnnotations
table or as part of anAnnotation
property value. -
getTypeIndex
public int getTypeIndex()The index in the classConstantPool
of theUTF8Entry
holding the type of this annotation. -
setTypeIndex
public void setTypeIndex(int index) The index in the classConstantPool
of theUTF8Entry
holding the type of this annotation. -
getTypeName
The name of this annotation's type. -
getType
TheClass
object for this annotation's type. -
getTypeBC
The bytecode for the type of this annotation. -
setType
This annotation's type. -
setType
This annotation's type. -
setType
This annotation's type. -
getProperties
All declared properties. -
setProperties
Set the annotation properties. This method is useful when importing properties from another instance. -
getProperty
Return the property with the given name, or null if none. -
addProperty
Import a property from another instance.- Returns:
- the newly added property
-
addProperty
Add a new property. -
clearProperties
public void clearProperties()Clear all annotation properties. -
removeProperty
Remove the given property.- Returns:
- true if an property was removed, false otherwise
-
removeProperty
Remove the property with the given name.- Returns:
- true if a property was removed, false otherwise
-
getProject
Description copied from interface:BCEntity
Return the project of the current class.- Specified by:
getProject
in interfaceBCEntity
-
getPool
Description copied from interface:BCEntity
Return the constant pool of the current class. -
getClassLoader
Description copied from interface:BCEntity
Return the class loader to use when loading related classes.- Specified by:
getClassLoader
in interfaceBCEntity
-
isValid
public boolean isValid()Description copied from interface:BCEntity
Return false if this entity has been removed from its parent; in this case the results of any operations on the entity are undefined. -
acceptVisit
Description copied from interface:VisitAcceptor
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.- Specified by:
acceptVisit
in interfaceVisitAcceptor
-