|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.biojava.bio.SimpleAnnotation
A no-frills implementation of Annotation that is just a wrapper around a Map.
It will allow you to set any property, but will throw exceptions if you try to retrieve a property that is not set.
Inner classes inherited from class org.biojava.bio.Annotation |
Annotation.EmptyAnnotation |
Fields inherited from interface org.biojava.bio.Annotation |
EMPTY_ANNOTATION |
Constructor Summary | |
SimpleAnnotation()
|
|
SimpleAnnotation(Annotation ann)
|
|
SimpleAnnotation(java.util.Map annMap)
|
Method Summary | |
java.util.Map |
asMap()
Retern a map that contains the same key/values as this Annotation. |
protected java.util.Map |
getProperties()
Retrieves properties, potentialy creating it if it was null. |
java.lang.Object |
getProperty(java.lang.Object key)
Retrieve the value of a property by key. |
java.util.Set |
keys()
Get a set of key objects. |
protected boolean |
propertiesAllocated()
A convenience method to see if we have allocated the properties map yet. |
void |
setProperty(java.lang.Object key,
java.lang.Object value)
Set the value of a property. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public SimpleAnnotation()
public SimpleAnnotation(Annotation ann) throws java.lang.IllegalArgumentException
public SimpleAnnotation(java.util.Map annMap)
Method Detail |
protected final java.util.Map getProperties()
protected final boolean propertiesAllocated()
public java.lang.Object getProperty(java.lang.Object key) throws java.util.NoSuchElementException
Unlike the Map collections, it will complain if the key does not exist. It will only return null if the key is defined and has value null.
key
- The key whose property to retrieve.public void setProperty(java.lang.Object key, java.lang.Object value)
This method throws an exception if either properties can not be added to this object, or that this particular property is immutable or illegal within the implementation.
key
- the key objectvalue
- the new value for this keykey
cannot
be changed.public java.util.Set keys()
public java.lang.String toString()
public java.util.Map asMap()
If the annotation changes, the map may not reflect this. The Map may be unmodifiable.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |