## org.biojava.bio
Interface Annotation

All Known Implementing Classes:
  AceAnnotation, Annotation.EmptyAnnotation, OverlayAnnotation, SimpleAnnotation

public interface Annotation

Arbitrary annotation associated with one or more objects.

Biological information often does not fit design patterns very well, and can be a jumble of facts and relationships. Annotation objects provide a standard way for you to store this mess as a property of an object.

Annotations may contain keys that have Annotations as values. In this way, annotations can be shared among multiple Annotatable objects, and you can represent semi-structured data.

It is perfectly possible to wrap up almost any tree-like or flat data structure as Annotation.

Author:
  Matthew Pocock

Inner Class Summary
`static class` `Annotation.EmptyAnnotation` The empty and immutable implementation.

Field Summary
`static Annotation` `EMPTY_ANNOTATION` A realy useful empty and immutable annotation object.

Method Summary
`java.util.Map` `asMap()` Retern a map that contains the same key/values as this Annotation.
`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.
`void` `setProperty(java.lang.Object key, java.lang.Object value)` Set the value of a property.

Field Detail

### EMPTY_ANNOTATION

    public static final Annotation EMPTY_ANNOTATION

  A realy useful empty and immutable annotation object.

  Use this instead of null when you realy don't want an object or an implementation to have annotation even though it should implement Annotatable.

Method Detail

### getProperty

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

  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.

  Parameters:
    `key` - the key of the property to retrieve
  Returns:
    the object associated with that key
  Throws:
    java.util.NoSuchElementException - if there is no property with the key

### setProperty

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

  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.

  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()

  Get a set of key objects.
  Returns:
    a Set of key objects

### asMap

    public java.util.Map asMap()

  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.

  Returns:
    a Map