org.progeeks.meta.annotate
Class DefaultAnnotationMap

java.lang.Object
  extended by org.progeeks.meta.annotate.DefaultAnnotationMap
All Implemented Interfaces:
AnnotationMap
Direct Known Subclasses:
MetaFormAnnotationMap

public class DefaultAnnotationMap
extends java.lang.Object
implements AnnotationMap

Base class and default implementation for the AnnotationMap interface.

Version:
$Revision: 1.5 $
Author:
Paul Speed

Constructor Summary
DefaultAnnotationMap()
          Creates a new DefaultAnnotationMap instance.
 
Method Summary
 java.lang.Object getAnnotation(java.lang.Object key)
          Returns the annotation associated with the specified key.
 AnnotationManager getAnnotationManager()
          Returns the AnnotationManager to which this AnnotationMap belongs.
 boolean isKeySupported(java.lang.Object key)
          Returns true if the map supports the specified key.
 boolean isMutable()
          Returns true if entries in the map can be added or updated.
 void setAnnotation(java.lang.Object key, java.lang.Object annotation)
          Sets the annotation object associated with the specified key.
 void setAnnotationManager(AnnotationManager manager)
          Sets the AnnotationManager to which this map belongs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultAnnotationMap

public DefaultAnnotationMap()
Creates a new DefaultAnnotationMap instance.

Method Detail

setAnnotationManager

public void setAnnotationManager(AnnotationManager manager)
Sets the AnnotationManager to which this map belongs. This is set explicitly by the AnnotationManager whenever the map is registered or auto-created. It is never necessary for other code to call this method.

Specified by:
setAnnotationManager in interface AnnotationMap

getAnnotationManager

public AnnotationManager getAnnotationManager()
Returns the AnnotationManager to which this AnnotationMap belongs.

Specified by:
getAnnotationManager in interface AnnotationMap

getAnnotation

public java.lang.Object getAnnotation(java.lang.Object key)
Returns the annotation associated with the specified key. Specific implementations may use delegation to parent annotation maps to resolve these references.

Specified by:
getAnnotation in interface AnnotationMap

setAnnotation

public void setAnnotation(java.lang.Object key,
                          java.lang.Object annotation)
                   throws ImmutableAnnotationMapException,
                          UnsupportedKeyException
Sets the annotation object associated with the specified key.

Specified by:
setAnnotation in interface AnnotationMap
Throws:
ImmutableAnnotationMapException - when the underlying implementation does not support adding or updating annotations. This can be the case for algorithmic annotations or for any annotations that cannot be changed at runtime.
UnsupportedKeyException

isMutable

public boolean isMutable()
Returns true if entries in the map can be added or updated. Returns true by default. Subclasses may override to restrict access but must also override setAnnotation() to throw the appropriate exception.

Specified by:
isMutable in interface AnnotationMap

isKeySupported

public boolean isKeySupported(java.lang.Object key)
Returns true if the map supports the specified key. The default implementation returns true since all keys are supported by default.

Specified by:
isKeySupported in interface AnnotationMap


Copyright © 2002-2003 Paul Speed. All Rights Reserved.