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.
-
AnnotationContextDip()
- Constructs an AnnotationContext instance.
-
addAnnotation(String)
- Adds an annotation to the bean.
-
createImplementation(Object)
- Creates an implementation of the dip.
-
createPropertyChangeListener(Object, String[])
- Returns an array of PropertyChangeListeners instances describing the method to
call after the dipped bean property change method is called.
-
getAnnotationAt(int)
- Gets the annotation at a specified index.
-
getContextElement()
- Gets all the annotations for an instance.
-
getContextElementName()
- Gets the name of the Context element.
-
getUpdatePolicy()
- Gets the update policy for the Context element.
-
propertyChange(PropertyChangeEvent)
- Checks to see if the property changed is in the
context update policy.
-
retrieveDip()
- Satisfies the DipPropertyChangeListener interface.
-
setAnnotationAt(String, int)
- Sets the annotation data at a specific index.
-
setContextElement(Object)
- Sets the AnnotationData Vector.
-
setUpdatePolicy(ContextUpdatePolicy)
- Sets the update policy for the Context element.
-
typeName()
- Gets the dip type name.
AnnotationContextDip
public AnnotationContextDip()
- Constructs an AnnotationContext instance.
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.
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.
addAnnotation
public void addAnnotation(String s)
- Adds an annotation to the bean.
- Parameters:
- s - The string that contains the annotation.
getContextElement
public Object getContextElement()
- Gets all the annotations for an instance.
- Returns:
- An AnnotationData object.
setContextElement
public void setContextElement(Object obj)
- Sets the AnnotationData Vector.
- Parameters:
- obj - The Vector of annotation data.
getContextElementName
public String getContextElementName()
- Gets the name of the Context element.
- Returns:
- A String that identifies the kind of context.
getUpdatePolicy
public ContextUpdatePolicy getUpdatePolicy()
- Gets the update policy for the Context element.
- Returns:
- A context policy update object.
setUpdatePolicy
public void setUpdatePolicy(ContextUpdatePolicy up)
- Sets the update policy for the Context element.
- Parameters:
- up - The context policy update object for this element.
typeName
public final String typeName()
- Gets the dip type name.
- Returns:
- The type name of the dip.
- Overrides:
- typeName in class SimpleDip
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
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
retrieveDip
public Dip retrieveDip()
- Satisfies the DipPropertyChangeListener interface.
- Returns:
- A reference to this instance.
- Overrides:
- retrieveDip in class SimpleDip
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