|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A bundle of attributes for some program element. Each attribute is an object. Simple attributes are string pairs, the key being the tag used to introduce the attribute and the value being the tag's argument. Complex attributes can be instances of any class.
The original order in which the attributes were specified is maintained by the iterators
and the toArray
converter.
Method Summary | |
void |
add(java.lang.Object attribute)
Add the given attribute to this bundle. |
void |
add(java.lang.Object attribute,
Creator creator)
Add the given non-serializable attribute to this bundle along with a serializable creator that can be used to recreate it. |
void |
add(java.lang.String key,
java.lang.String value)
Add a simple attribute with the given key and value. |
void |
clear()
Clear the contents of this bundle, removing all attributes. |
java.lang.Object |
get(java.lang.Class klass)
Get an object attribute whose type is assignable to the given type. |
java.lang.String |
get(java.lang.String key)
Get the string value matching the given key. |
boolean |
has(java.lang.Class klass)
Return whether this bundle has any object attributes whose type is assignable to the given type. |
boolean |
has(java.lang.String key)
Return whether this bundle has any string attributes for the given key. |
Bundle |
includingInherited()
Return a composite bundle that includes all attributes inherited from supertypes by this element. |
java.util.Iterator |
iterator()
An iterator over all the attributes in this bundle, in declaration order. |
java.util.Iterator |
iterator(java.lang.Class klass)
Get an iterator over all object attributes whose type is assignable to the given type. |
java.util.Iterator |
iterator(java.lang.String key)
Get an iterator over the values of all the simple attributes with the given key. |
int |
size()
Return the number of attributes in this bundle. |
java.lang.Object[] |
toArray()
Return a new array with all the attributes from this bundle. |
Method Detail |
public void add(java.lang.Object attribute)
attribute
- the attribute to be addedpublic void add(java.lang.Object attribute, Creator creator)
attribute
- the attribute to be addedcreator
- a creator that can be used to re-create the attributepublic void add(java.lang.String key, java.lang.String value)
key
- the key of the attribute to addvalue
- the value of the attribute to addpublic void clear()
public java.lang.Object get(java.lang.Class klass)
klass
- a supertype of the desired attribute type
null
if none
MultipleValuesException
- if there is more than one attribute assignable to the given typepublic java.lang.String get(java.lang.String key)
key
- the desired attribute's key
null
if the key is not present in this bundle
MultipleValuesException
- if there is more than one value for the given keypublic boolean has(java.lang.Class klass)
klass
- a supertype of the desired attribute type
public boolean has(java.lang.String key)
key
- the desired attribute key
public Bundle includingInherited()
java.lang.UnsupportedOperationException
- if unable to obtain inherited attributes for any reasonpublic java.util.Iterator iterator()
public java.util.Iterator iterator(java.lang.Class klass)
klass
- a supertype of the desired attribute type
public java.util.Iterator iterator(java.lang.String key)
key
- the desired attributes' key
public int size()
public java.lang.Object[] toArray()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |