All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.beans.samples.dips.context.AnnotationContextDip

java.lang.Object
   |
   +----com.ibm.beans.dip.SimpleDip
           |
           +----com.ibm.beans.samples.dips.context.AnnotationContextDip

public final class AnnotationContextDip
extends SimpleDip
implements ContextElement, Serializable, DipPropertyChangeListener
The AnnotationContext class is a dip that allows the user to add notes to an instance of a bean. These notes are restricted to text.

Each annotation allows multiple text notes to a single bean instance.


Constructor Index

 o AnnotationContextDip()
Constructs an AnnotationContext instance.

Method Index

 o addAnnotation(String)
Adds an annotation to the bean.
 o createImplementation(Object)
Creates an implementation of the dip.
 o createPropertyChangeListener(Object, String[])
Returns an array of PropertyChangeListeners instances describing the method to call after the dipped bean property change method is called.
 o getAnnotationAt(int)
Gets the annotation at a specified index.
 o getContextElement()
Gets all the annotations for an instance.
 o getContextElementName()
Gets the name of the Context element.
 o getUpdatePolicy()
Gets the update policy for the Context element.
 o propertyChange(PropertyChangeEvent)
Checks to see if the property changed is in the context update policy.
 o retrieveDip()
Satisfies the DipPropertyChangeListener interface.
 o setAnnotationAt(String, int)
Sets the annotation data at a specific index.
 o setContextElement(Object)
Sets the AnnotationData Vector.
 o setUpdatePolicy(ContextUpdatePolicy)
Sets the update policy for the Context element.
 o typeName()
Gets the dip type name.

Constructors

 o AnnotationContextDip
 public AnnotationContextDip()
Constructs an AnnotationContext instance.

Methods

 o getAnnotationAt
 public String[] getAnnotationAt(int i)
Gets the annotation at a specified index.

Parameters:
i - An integer for the index of the annotation desired.
Returns:
An array of Strings, the annotation at the specified index.
 o setAnnotationAt
 public void setAnnotationAt(String s,
                             int i)
Sets the annotation data at a specific index.

Parameters:
s - The annotation data.
i - The element of the array at which the update is to occur.
 o addAnnotation
 public void addAnnotation(String s)
Adds an annotation to the bean.

Parameters:
s - The string that contains the annotation.
 o getContextElement
 public Object getContextElement()
Gets all the annotations for an instance.

Returns:
An AnnotationData object.
 o setContextElement
 public void setContextElement(Object obj)
Sets the AnnotationData Vector.

Parameters:
obj - The Vector of annotation data.
 o getContextElementName
 public String getContextElementName()
Gets the name of the Context element.

Returns:
A String that identifies the kind of context.
 o getUpdatePolicy
 public ContextUpdatePolicy getUpdatePolicy()
Gets the update policy for the Context element.

Returns:
A context policy update object.
 o setUpdatePolicy
 public void setUpdatePolicy(ContextUpdatePolicy up)
Sets the update policy for the Context element.

Parameters:
up - The context policy update object for this element.
 o typeName
 public final String typeName()
Gets the dip type name.

Returns:
The type name of the dip.
Overrides:
typeName in class SimpleDip
 o createImplementation
 public Object createImplementation(Object obj) throws DipRejectAdditionException
Creates an implementation of the dip. For the annotation context, createImplementation returns a pointer to itself.

Parameters:
obj - The bean being dipped.
Returns:
This object.
Throws: DipRejectAdditionException
This exception is thrown if the dip rejects being added to the bean. Annotation context does not throw this exception.
Overrides:
createImplementation in class SimpleDip
 o createPropertyChangeListener
 public DipPropertyChangeListener[] createPropertyChangeListener(Object imp,
                                                                 String methods[]) throws DipRejectAdditionException
Returns an array of PropertyChangeListeners instances describing the method to call after the dipped bean property change method is called. The annotation context dip listens for property change events itself.

Parameters:
imp - This is the implementation returned from createImplementation().
methods[] - This is the array of event methods in the dippable bean.
Returns:
The array of PropertyChangeListeners. Each one is this instance of the annotation context dip.
Throws: DipRejectAdditionException
This exception is thrown if the dip rejects being added to the bean. Annotation context does not throw this exception.
Overrides:
createPropertyChangeListener in class SimpleDip
 o retrieveDip
 public Dip retrieveDip()
Satisfies the DipPropertyChangeListener interface.

Returns:
A reference to this instance.
Overrides:
retrieveDip in class SimpleDip
 o propertyChange
 public synchronized void propertyChange(PropertyChangeEvent evt)
Checks to see if the property changed is in the context update policy. If it is, the method invokes an annotation Dialog. The annotation dialog allows the user to attach notes to instances of a bean.

Parameters:
evt -
the PropertyChangeEvent that the dip heard. This is checked against the properties registered in the context update policy.

All Packages  Class Hierarchy  This Package  Previous  Next  Index