imageorg
Interface Annotation

All Superinterfaces:
java.io.Serializable

public interface Annotation
extends java.io.Serializable

Annotation is container for holding a set of user-defined, descriptive data elements. Annotations can be added to FileElements. An Annotation has a key (String) and a set of values associated with it. Annotation values are designed to be searchable. Here is an example:

Say the user has an Image of a beach at sunset. They might create an Annotation that has the key "Category" and one value "landscape". They might then create a further Annotation that has the key "Key words" and values "beach", "sunset", "Hawaii", etc. They might then create a further Annotation with the key "Description" and one value "Taken while on holiday in 2002". You get the idea.

Notice that the method to add an annotation value takes an Object as argument. For this assignment, only Strings will be added as annotation values. However, the design allows for arbitrary objects to be added as annotation values. This would allow for non-text annotation values (e.g. sound bites, icons etc).

See Also:
Serializable

Method Summary
 void addAnnotationValue(java.lang.Object value)
          Add a value to this annotation.
 java.lang.String getAnnotationKey()
          Return this Annotation's key
 java.util.Collection getValues()
          Get a collection encapsulating all the values in this Annotation.
 boolean removeAnnotationValue(java.lang.Object value)
          Remove a value from this Annotation.
 void setAnnotationKey(java.lang.String text)
          Set the String to use as this Annotation's key.
 java.lang.String toString()
          Return a formatted String description of this Annotation.
 

Method Detail

setAnnotationKey

void setAnnotationKey(java.lang.String text)
Set the String to use as this Annotation's key.

Parameters:
text - the value to use as the key
(Precondition: text != null)

getAnnotationKey

java.lang.String getAnnotationKey()
Return this Annotation's key

Returns:
the key

addAnnotationValue

void addAnnotationValue(java.lang.Object value)
Add a value to this annotation.

Parameters:
value - an Object (typically a String) to associate with this Annotation.
(Precondition: value != null)

removeAnnotationValue

boolean removeAnnotationValue(java.lang.Object value)
Remove a value from this Annotation.

Parameters:
value - the Object value to remove from this Annotation.
(Precondition: value != null)
Returns:
true if the value was removed successfully, or false in all other cases (e.g. value does not exist in this Annotation).

getValues

java.util.Collection getValues()
Get a collection encapsulating all the values in this Annotation.

Returns:
a Collection of this Annotation's values.

toString

java.lang.String toString()
Return a formatted String description of this Annotation.

Overrides:
toString in class java.lang.Object
Returns:
a textual description of this Annotation.