org.limitless.util
Interface Annotation

All Known Subinterfaces:
MessageEvent.Source
All Known Implementing Classes:
GeneralAnnotation, MuConnector

public interface Annotation

Describes an interface for Annotating objects. Annotatable Objects can store other Objects indexed by arbitrary keys and return them on demand. This is similar in concept to the Preferences system, except that values can be keyed to arbitrary objects instead of just strings.

Author:
Nicholas Pilon

Nested Class Summary
static class Annotation.AnnotationNotFoundException
          This exception indicates that the requested annotation was not present on this object.
 
Method Summary
 java.lang.Object getAnnotation(java.lang.Object key)
          Returns the annotation keyed to the passed-in Object.
 java.lang.Object removeAnnotation(java.lang.Object key)
          Removes and returns the annotation keyed to the passed-in Object.
 void setAnnotation(java.lang.Object key, java.lang.Object data)
          Sets an annotation to hold an Object, keyed to the given key Object.
 

Method Detail

setAnnotation

void setAnnotation(java.lang.Object key,
                   java.lang.Object data)
Sets an annotation to hold an Object, keyed to the given key Object.

Parameters:
key - The key to use for this Object.
data - The data to store.

getAnnotation

java.lang.Object getAnnotation(java.lang.Object key)
                               throws Annotation.AnnotationNotFoundException
Returns the annotation keyed to the passed-in Object.

Parameters:
key - The key to search for.
Returns:
The Object found at the given key.
Throws:
Annotation.AnnotationNotFoundException - If no object is found for the key.

removeAnnotation

java.lang.Object removeAnnotation(java.lang.Object key)
                                  throws Annotation.AnnotationNotFoundException
Removes and returns the annotation keyed to the passed-in Object.

Parameters:
key - The key to search for.
Returns:
The Object deleted at the given key.
Throws:
Annotation.AnnotationNotFoundException - If no object is found for the key.


Copyright © 1995, 2004 Limitless Knowledge Association, All Rights Reserved.