serp.bytecode
Class Attributes

java.lang.Object
  extended by serp.bytecode.Attributes
All Implemented Interfaces:
BCEntity
Direct Known Subclasses:
Annotated, Attribute

public abstract class Attributes
extends Object
implements BCEntity

Abstract superclass for all bytecode entities that hold attributes.

Author:
Abe White

Constructor Summary
Attributes()
           
 
Method Summary
 Attribute addAttribute(Attribute attr)
          Import an attribute from another entity, or make a copy of one on this entity.
 Attribute addAttribute(String name)
          Add an attribute of the given type.
 void clearAttributes()
          Clear all attributes from this entity.
 Attribute getAttribute(String name)
          Return the attribute with the given name.
 Attribute[] getAttributes()
          Return all the attributes owned by this entity.
 Attribute[] getAttributes(String name)
          Return all attributes with the given name.
 boolean removeAttribute(Attribute attribute)
          Remove the given attribute.
 boolean removeAttribute(String name)
          Remove all attributes with the given name from this entity.
 void setAttributes(Attribute[] attrs)
          Set the attributes for this entity; this method is useful for importing all attributes from another entity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface serp.bytecode.BCEntity
getClassLoader, getPool, getProject, isValid
 

Constructor Detail

Attributes

public Attributes()
Method Detail

getAttributes

public Attribute[] getAttributes()
Return all the attributes owned by this entity.

Returns:
all owned attributes, or empty array if none

getAttribute

public Attribute getAttribute(String name)
Return the attribute with the given name. If multiple attributes share the name, which is returned is undefined.


getAttributes

public Attribute[] getAttributes(String name)
Return all attributes with the given name.

Returns:
the matching attributes, or empty array if none

setAttributes

public void setAttributes(Attribute[] attrs)
Set the attributes for this entity; this method is useful for importing all attributes from another entity. Set to null or empty array if none.


addAttribute

public Attribute addAttribute(Attribute attr)
Import an attribute from another entity, or make a copy of one on this entity.


addAttribute

public Attribute addAttribute(String name)
Add an attribute of the given type.


clearAttributes

public void clearAttributes()
Clear all attributes from this entity.


removeAttribute

public boolean removeAttribute(String name)
Remove all attributes with the given name from this entity.

Returns:
true if an attribute was removed, false otherwise

removeAttribute

public boolean removeAttribute(Attribute attribute)
Remove the given attribute. After being removed, the attribute is invalid, and the result of any operations on it are undefined.

Returns:
true if the attribute was removed, false otherwise


Copyright © 2002-2007. All Rights Reserved.