## org.biojava.bio
Class SimpleAnnotation

    java.lang.Object
      |
      +--org.biojava.bio.SimpleAnnotation

public class SimpleAnnotation
extends java.lang.Object
implements Annotation, java.io.Serializable

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
See Also:
  Serialized Form

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

### SimpleAnnotation

    public SimpleAnnotation()

### SimpleAnnotation

    public SimpleAnnotation(Annotation ann)
                     throws java.lang.IllegalArgumentException

### SimpleAnnotation

    public SimpleAnnotation(java.util.Map annMap)

Method Detail

### getProperties

    protected final java.util.Map getProperties()

  Retrieves properties, potentialy creating it if it was null.
  Returns:
    the properties Map

### propertiesAllocated

    protected final boolean propertiesAllocated()

  A convenience method to see if we have allocated the properties map yet.

### getProperty

    public java.lang.Object getProperty(java.lang.Object key)
                                 throws java.util.NoSuchElementException

  Description copied from interface: Annotation
  Retrieve the value of a property by key.

  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.

  Specified by:
    getProperty in interface Annotation
  Parameters:
    `key` - The key whose property to retrieve.
  Throws:
    java.util.NoSuchElementException - if the property 'key' does not exist

### setProperty

    public void setProperty(java.lang.Object key,
                            java.lang.Object value)

  Description copied from interface: Annotation
  Set the value of a property.

  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.

  Specified by:
    setProperty in interface Annotation
  Tags copied from interface: Annotation
  Parameters:
    `key` - the key object
    `value` - the new value for this key
  Throws:
    java.lang.IllegalArgumentException - if the property `key` cannot be changed.
    java.lang.UnsupportedOperationException - if this annotation object is immutable.

### keys

    public java.util.Set keys()

  Description copied from interface: Annotation
  Get a set of key objects.
  Specified by:
    keys in interface Annotation
  Tags copied from interface: Annotation
  Returns:
    a Set of key objects

### toString

    public java.lang.String toString()

  Overrides:
    toString in class java.lang.Object

### asMap

    public java.util.Map asMap()

  Description copied from interface: Annotation
  Retern a map that contains the same key/values as this Annotation.

  If the annotation changes, the map may not reflect this. The Map may be unmodifiable.

  Specified by:
    asMap in interface Annotation
  Tags copied from interface: Annotation
  Returns:
    a Map