net.sf.okapi.common.annotation
Class Annotations

java.lang.Object
  extended by 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
Annotations()
          Creates a new Annotations object.
 
Method Summary
 void clear()
          Removes all the annotations in this object.
 Annotations clone()
           
<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.
protected  void setAnnotations(java.util.concurrent.ConcurrentHashMap<java.lang.Class<? extends IAnnotation>,IAnnotation> annotations)
          Used by clone method to copy over all annotations at once.
 
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.

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.

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.

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()
Overrides:
clone in class java.lang.Object

setAnnotations

protected void setAnnotations(java.util.concurrent.ConcurrentHashMap<java.lang.Class<? extends IAnnotation>,IAnnotation> annotations)
Used by clone method to copy over all annotations at once.

Parameters:
annotations -

iterator

public java.util.Iterator<IAnnotation> iterator()
Specified by:
iterator in interface java.lang.Iterable<IAnnotation>