net.sf.okapi.common.annotation

## Class Annotations

- java.lang.Object
- - net.sf.okapi.common.annotation.Annotations

- All Implemented Interfaces:
    java.lang.Iterable<IAnnotation>

      public class Annotations
      extends java.lang.Object
      implements java.lang.Iterable<IAnnotation>

  Provides annotation mechanism to the resources.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Annotations()` Creates a new Annotations object.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clear()` Removes all the annotations in this object.
    `Annotations` | `clone()` Clones this Annotations object.
    `<A extends IAnnotation> A` | `get(java.lang.Class<A> annotationType)` Gets the annotation for a given type.
    `java.util.Iterator<IAnnotation>` | `iterator()`
    `<A extends IAnnotation> A` | `remove(java.lang.Class<A> annotationType)` Removes the annotation of a given type.
    `<T extends IAnnotation> void` | `set(T annotation)` Sets an annotation.

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Annotations

          public Annotations()

      Creates a new Annotations object.

  - ### Method Detail

    - #### set

          public <T extends IAnnotation> void set(T annotation)

      Sets an annotation.
      Type Parameters:
        `T` - the annotation type.
      Parameters:
        `annotation` - The annotation object to set.

    - #### get

          public <A extends IAnnotation> A get(java.lang.Class<A> annotationType)

      Gets the annotation for a given type.
      Type Parameters:
        `A` - the annotation type
      Parameters:
        `annotationType` - Type of the annotation to retrieve.
      Returns:
        The found annotation, or null if no annotation of the given type was found.

    - #### clear

          public void clear()

      Removes all the annotations in this object.

    - #### remove

          public <A extends IAnnotation> A remove(java.lang.Class<A> annotationType)

      Removes the annotation of a given type.
      Type Parameters:
        `A` - the annotation type
      Parameters:
        `annotationType` - Type of the annotation to remove.
      Returns:
        The removed annotation, or null if no annotation of the given type was found.

    - #### clone

          public Annotations clone()

      Clones this Annotations object.

      Important: the annotations themselves are not cloned, only the map holding them is new.

      Overrides:
        `clone` in class `java.lang.Object`
      Returns:
        the cloned object.

    - #### iterator

          public java.util.Iterator<IAnnotation> iterator()

      Specified by:
        `iterator` in interface `java.lang.Iterable<IAnnotation>`