serp.bytecode
Class Annotation

java.lang.Object
  extended by serp.bytecode.Annotation
All Implemented Interfaces:
BCEntity, VisitAcceptor

public class Annotation
extends Object
implements BCEntity, VisitAcceptor

A declared annotation.

Author:
Abe White

Nested Class Summary
static class Annotation.Property
          An annotation property.
 
Method Summary
 void acceptVisit(BCVisitor visit)
          Accept a visit from a BCVisitor, 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.Property addProperty(Annotation.Property p)
          Import a property from another instance.
 Annotation.Property addProperty(String name)
          Add a new property.
 void clearProperties()
          Clear all annotation properties.
 ClassLoader getClassLoader()
          Return the class loader to use when loading related classes.
 BCEntity getOwner()
          Annotations are stored in an Annotations table or as part of an Annotation property value.
 ConstantPool getPool()
          Return the constant pool of the current class.
 Project getProject()
          Return the project of the current class.
 Annotation.Property[] getProperties()
          All declared properties.
 Annotation.Property getProperty(String name)
          Return the property with the given name, or null if none.
 Class getType()
          The Class object for this annotation's type.
 BCClass getTypeBC()
          The bytecode for the type of this annotation.
 int getTypeIndex()
          The index in the class ConstantPool of the UTF8Entry holding the type of this annotation.
 String getTypeName()
          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(Annotation.Property prop)
          Remove the given property.
 boolean removeProperty(String name)
          Remove the property with the given name.
 void setProperties(Annotation.Property[] props)
          Set the annotation properties.
 void setType(BCClass type)
          This annotation's type.
 void setType(Class type)
          This annotation's type.
 void setType(String type)
          This annotation's type.
 void setTypeIndex(int index)
          The index in the class ConstantPool of the UTF8Entry holding the type of this annotation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getOwner

public BCEntity getOwner()
Annotations are stored in an Annotations table or as part of an Annotation property value.


getTypeIndex

public int getTypeIndex()
The index in the class ConstantPool of the UTF8Entry holding the type of this annotation.


setTypeIndex

public void setTypeIndex(int index)
The index in the class ConstantPool of the UTF8Entry holding the type of this annotation.


getTypeName

public String getTypeName()
The name of this annotation's type.


getType

public Class getType()
The Class object for this annotation's type.


getTypeBC

public BCClass getTypeBC()
The bytecode for the type of this annotation.


setType

public void setType(String type)
This annotation's type.


setType

public void setType(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(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(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(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: BCEntity
Return the project of the current class.

Specified by:
getProject in interface BCEntity

getPool

public ConstantPool getPool()
Description copied from interface: BCEntity
Return the constant pool of the current class.

Specified by:
getPool in interface BCEntity

getClassLoader

public ClassLoader getClassLoader()
Description copied from interface: BCEntity
Return the class loader to use when loading related classes.

Specified by:
getClassLoader in interface BCEntity

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.

Specified by:
isValid in interface BCEntity

acceptVisit

public void acceptVisit(BCVisitor visit)
Description copied from interface: VisitAcceptor
Accept a visit from a BCVisitor, 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 interface VisitAcceptor


Copyright © 2002-2007. All Rights Reserved.