org.biojava.bio
Class SimpleAnnotation

java.lang.Object
  extended byorg.biojava.utils.AbstractChangeable
      extended byorg.biojava.bio.AbstractAnnotation
          extended byorg.biojava.bio.SimpleAnnotation
All Implemented Interfaces:
Annotation, Changeable, java.io.Serializable

public class SimpleAnnotation
extends AbstractAnnotation

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.

Author:
Matthew Pocock, Greg Cox
See Also:
Serialized Form
For general use:
When you need to make a new Annotation instance and will want to populate it with properties, use this class.

Field Summary
 
Fields inherited from interface org.biojava.bio.Annotation
EMPTY_ANNOTATION, PROPERTY
 
Constructor Summary
SimpleAnnotation()
          Create a new, empty SimpleAnnotation instance.
SimpleAnnotation(Annotation ann)
          Create a new SimpleAnnotation by copying the properties from another one.
SimpleAnnotation(java.util.Map map)
          Create a new SimpleAnnotation using the values in a Map.
 
Method Summary
protected  java.util.Map getProperties()
          Implement this to return the Map delegate.
protected  boolean propertiesAllocated()
          A convenience method to see if we have allocated the properties Map.
 
Methods inherited from class org.biojava.bio.AbstractAnnotation
asMap, containsProperty, equals, getProperty, hashCode, keys, removeProperty, setProperty, toString
 
Methods inherited from class org.biojava.utils.AbstractChangeable
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
 

Constructor Detail

SimpleAnnotation

public SimpleAnnotation()
Create a new, empty SimpleAnnotation instance.


SimpleAnnotation

public SimpleAnnotation(Annotation ann)
                 throws java.lang.IllegalArgumentException
Create a new SimpleAnnotation by copying the properties from another one. The new Annotation instance will be independant of the original.

Parameters:
ann - the Annotation to copy

SimpleAnnotation

public SimpleAnnotation(java.util.Map map)
Create a new SimpleAnnotation using the values in a Map.

Parameters:
map - the Map to copy properties out of
Method Detail

getProperties

protected final java.util.Map getProperties()
Description copied from class: AbstractAnnotation
Implement this to return the Map delegate. From code in the 1.2 version of AbstractAnnotation

Specified by:
getProperties in class AbstractAnnotation

propertiesAllocated

protected final boolean propertiesAllocated()
Description copied from class: AbstractAnnotation
A convenience method to see if we have allocated the properties Map.

Specified by:
propertiesAllocated in class AbstractAnnotation
Returns:
true if the properties have been allocated, false otherwise