|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.ideanest.attributes.impl.SimpleBundle
A simple ordered bundle of attributes. This implementation keeps the attributes in an object array, and uses linear search to find entries. Normally, there's so few attributes in a bundle that the running time of a linear search should be comparable to more efficient methods (e.g. hash map). The array also allows duplicate keys, keeps the order of all the attributes, and should save memory.
| Constructor Summary | |
SimpleBundle()
|
|
| 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. |
void |
readExternal(java.io.ObjectInput in)
|
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. |
void |
writeExternal(java.io.ObjectOutput out)
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SimpleBundle()
| Method Detail |
public void add(java.lang.Object attribute)
Bundle
add in interface Bundleattribute - the attribute to be added
public void add(java.lang.Object attribute,
Creator creator)
Bundle
add in interface Bundleattribute - the attribute to be addedcreator - a creator that can be used to re-create the attribute
public void add(java.lang.String key,
java.lang.String value)
Bundle
add in interface Bundlekey - the key of the attribute to addvalue - the value of the attribute to addpublic void clear()
Bundle
clear in interface Bundlepublic java.lang.Object get(java.lang.Class klass)
Bundle
get in interface Bundleklass - a supertype of the desired attribute type
null if nonepublic java.lang.String get(java.lang.String key)
Bundle
get in interface Bundlekey - the desired attribute's key
null if the key is not present in this bundlepublic boolean has(java.lang.Class klass)
Bundle
has in interface Bundleklass - a supertype of the desired attribute type
public boolean has(java.lang.String key)
Bundle
has in interface Bundlekey - the desired attribute key
public Bundle includingInherited()
Bundle
includingInherited in interface Bundlepublic java.util.Iterator iterator()
Bundle
iterator in interface Bundlepublic java.util.Iterator iterator(java.lang.Class klass)
Bundle
iterator in interface Bundleklass - a supertype of the desired attribute type
public java.util.Iterator iterator(java.lang.String key)
Bundle
iterator in interface Bundlekey - the desired attributes' key
public void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
readExternal in interface java.io.Externalizablejava.io.IOException
java.lang.ClassNotFoundExceptionpublic int size()
Bundle
size in interface Bundlepublic java.lang.Object[] toArray()
Bundle
toArray in interface Bundle
public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.Externalizablejava.io.IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||