SMILA (incubation) API documentation

org.eclipse.smila.datamodel.record.impl
Class AnnotatableImpl

java.lang.Object
  extended by org.eclipse.smila.datamodel.record.impl.AnnotatableImpl
All Implemented Interfaces:
java.io.Serializable, Annotatable
Direct Known Subclasses:
AnnotationImpl, AttributeImpl, AttributeValueImpl, ExtensionAdapter

public abstract class AnnotatableImpl
extends java.lang.Object
implements Annotatable, java.io.Serializable

Abstract base class for SMILA data model default implentation: Everything is annotatable (except records).

Author:
jschumacher
See Also:
Serialized Form

Constructor Summary
AnnotatableImpl()
           
 
Method Summary
 void addAnnotation(java.lang.String name, Annotation annotation)
          add a single annotation for the specified name.
 int annotationsSize()
          get number of annotations.
 Annotation getAnnotation(java.lang.String name)
          get the first annotation for the specified name.
 java.util.Iterator<java.lang.String> getAnnotationNames()
          get an iterator on the names of all attached annotations.
 java.util.Collection<Annotation> getAnnotations(java.lang.String name)
          get the list of annotations for the specified name.
 boolean hasAnnotation(java.lang.String name)
          Check if this object has an annotation of the specified name.
 boolean hasAnnotations()
          Check if this object has annotations attached.
 void removeAnnotations()
          remove all current annotations.
 void removeAnnotations(java.lang.String name)
          remove all current annotations of the specified name.
 void setAnnotation(java.lang.String name, Annotation annotation)
          set a single annotation for the specified name.
 void setAnnotations(java.lang.String name, java.util.Collection<? extends Annotation> annotations)
          set the list of annotations for a given name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotatableImpl

public AnnotatableImpl()
Method Detail

addAnnotation

public void addAnnotation(java.lang.String name,
                          Annotation annotation)
add a single annotation for the specified name. The list of currently existing annotation is extended.

Specified by:
addAnnotation in interface Annotatable
Parameters:
name - name of annotation
annotation - new annotation to add.
See Also:
Annotatable.addAnnotation(java.lang.String, org.eclipse.smila.datamodel.record.Annotation)

getAnnotation

public Annotation getAnnotation(java.lang.String name)
get the first annotation for the specified name. Makes usually only sense if is sure that only one annotation with this name can exist, because some implementations might not be able to guarantee the order of annotations.

Specified by:
getAnnotation in interface Annotatable
Parameters:
name - name of annotation.
Returns:
the first annotation in the list of known annotations. Null, if no annotations of this name exist.
See Also:
Annotatable.getAnnotation(java.lang.String)

getAnnotationNames

public java.util.Iterator<java.lang.String> getAnnotationNames()
get an iterator on the names of all attached annotations.

Specified by:
getAnnotationNames in interface Annotatable
Returns:
an iterator on annotation names.
See Also:
Annotatable.getAnnotationNames()

getAnnotations

public java.util.Collection<Annotation> getAnnotations(java.lang.String name)
get the list of annotations for the specified name.

Specified by:
getAnnotations in interface Annotatable
Parameters:
name - name of annotation.
Returns:
list of annotations with this name. Null, if no annotations of this name exists.
See Also:
Annotatable.getAnnotations(java.lang.String)

hasAnnotation

public boolean hasAnnotation(java.lang.String name)
Check if this object has an annotation of the specified name.

Specified by:
hasAnnotation in interface Annotatable
Parameters:
name - name of annotation to check for.
Returns:
true if an annotation of this name exists, else false.
See Also:
Annotatable.hasAnnotation(java.lang.String)

hasAnnotations

public boolean hasAnnotations()
Check if this object has annotations attached.

Specified by:
hasAnnotations in interface Annotatable
Returns:
true if annotations are attached, else false.
See Also:
Annotatable.hasAnnotations()

removeAnnotations

public void removeAnnotations(java.lang.String name)
remove all current annotations of the specified name.

Specified by:
removeAnnotations in interface Annotatable
Parameters:
name - name of annotation
See Also:
Annotatable.removeAnnotations(java.lang.String)

removeAnnotations

public void removeAnnotations()
remove all current annotations.

Specified by:
removeAnnotations in interface Annotatable
See Also:
Annotatable.removeAnnotations()

setAnnotation

public void setAnnotation(java.lang.String name,
                          Annotation annotation)
set a single annotation for the specified name. All existing annotations of this name are replaced.

Specified by:
setAnnotation in interface Annotatable
Parameters:
name - name of annotation
annotation - new annotation to set.
See Also:
Annotatable.setAnnotation(java.lang.String, org.eclipse.smila.datamodel.record.Annotation)

setAnnotations

public void setAnnotations(java.lang.String name,
                           java.util.Collection<? extends Annotation> annotations)
set the list of annotations for a given name. All existing annotations of this name are replaced.

Specified by:
setAnnotations in interface Annotatable
Parameters:
name - name of annotation
annotations - new list of annotations to set
See Also:
org.eclipse.smila.datamodel.record.Annotatable#setAnnotations(java.lang.String, java.util.List)

annotationsSize

public int annotationsSize()
get number of annotations.

Specified by:
annotationsSize in interface Annotatable
Returns:
number of annotations.
See Also:
Annotatable.annotationsSize()

SMILA (incubation) API documentation