dsto.dfc.databeans
Class DataObjectLink

java.lang.Object
  extended by dsto.dfc.databeans.AbstractDataObject
      extended by dsto.dfc.databeans.DataObjectLink
All Implemented Interfaces:
IDataObject, IDataObjectChildListener, IDataObjectLink, PropertyListener, Cloneable, EventListener
Direct Known Subclasses:
DataObjectWeakRef

public class DataObjectLink
extends AbstractDataObject
implements IDataObject, IDataObjectLink, PropertyListener

A link to an IDataObject that also provides a facade to the object (i.e. exposes the same property set).

Version:
$Revision$
Author:
mpp
See Also:
DataBeanLink

Field Summary
protected  boolean isSoftLink
           
protected  IDataObject object
           
 
Fields inherited from class dsto.dfc.databeans.AbstractDataObject
listeners
 
Fields inherited from interface dsto.dfc.databeans.IDataObject
OVERRIDE, PERSISTENT, PERSISTENT_OVERRIDE, TRANSIENT, TRANSIENT_OVERRIDE
 
Constructor Summary
DataObjectLink()
          Create a link with no target.
DataObjectLink(IDataObject object)
           
DataObjectLink(IDataObject object, boolean isSoftLink)
           
 
Method Summary
 void dispose()
           
protected  void disposeListener()
           
 IDataObject getLinkTarget()
          Get the data object that this link points to.
 TypeInfo getTypeInfo()
          Get the optional type information for this object.
 Object getValue(Object name)
          Get the value of a given property.
protected  void initListener()
           
 boolean isSoftLink()
          True if this is a soft link.
 boolean isTransient(Object name)
          Test a property is transient (ie will not be preserved if the object is saved).
 Iterator propertyIterator()
          Get an iterator that scans over all currently defined properties.
 void propertyValueChanged(PropertyEvent e)
           
 void setLinkTarget(IDataObject target)
          Set the object being pointed to by this link.
 void setSoftLink(boolean newValue)
           
 void setValue(Object name, Object value)
          Synonym for setValue (name, value, PERSISTENT_OVERRIDE).
 void setValue(Object name, Object value, int mode)
          Set the value of a given property.
 IDataObject shallowClone()
          Shallow clone the object prior to being recusively "deep" cloned.
 
Methods inherited from class dsto.dfc.databeans.AbstractDataObject
addFirstPropertyListener, addPropertyListener, childPropertyChanged, firePropertyChangedEvent, firePropertyChangedEvent, firePropertyChangedEvent, firePropertyChangedEvent, firePropertyChangedEvent, firePropertyChangedEvent, getBeanValue, getBooleanValue, getBooleanValue, getCharValue, getCharValue, getDoubleValue, getDoubleValue, getFloatValue, getFloatValue, getIntValue, getIntValue, getLongValue, getLongValue, getObjectValue, getPropertyListeners, getShortValue, getStringValue, registerValue, removePropertyListener, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, toString, unregisterValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface dsto.dfc.databeans.IDataObject
addPropertyListener, getPropertyListeners, removePropertyListener
 

Field Detail

object

protected IDataObject object

isSoftLink

protected boolean isSoftLink
Constructor Detail

DataObjectLink

public DataObjectLink()
Create a link with no target. Use setLinkTarget(IDataObject) before use or Bad Things will occur.


DataObjectLink

public DataObjectLink(IDataObject object)

DataObjectLink

public DataObjectLink(IDataObject object,
                      boolean isSoftLink)
Method Detail

dispose

public void dispose()

initListener

protected void initListener()

disposeListener

protected void disposeListener()

getLinkTarget

public IDataObject getLinkTarget()
Description copied from interface: IDataObjectLink
Get the data object that this link points to.

Specified by:
getLinkTarget in interface IDataObjectLink

setLinkTarget

public void setLinkTarget(IDataObject target)
Set the object being pointed to by this link. Not recommended to be used outside of initialisation.


isSoftLink

public boolean isSoftLink()
Description copied from interface: IDataObjectLink
True if this is a soft link. Soft links do not automatically propagate events from from the linked object.

Specified by:
isSoftLink in interface IDataObjectLink

setSoftLink

public void setSoftLink(boolean newValue)

setValue

public void setValue(Object name,
                     Object value)
Description copied from class: AbstractDataObject
Synonym for setValue (name, value, PERSISTENT_OVERRIDE).

Specified by:
setValue in interface IDataObject
Overrides:
setValue in class AbstractDataObject
Parameters:
name - The property "name" (may be any object).
value - The property value.
See Also:
IDataObject.setValue(Object, Object, int), IDataObject.getValue(Object), PropertyListener, PropertyEvent

setValue

public void setValue(Object name,
                     Object value,
                     int mode)
Description copied from interface: IDataObject
Set the value of a given property. If the object supports it, a property change event should be emitted.

Specified by:
setValue in interface IDataObject
Specified by:
setValue in class AbstractDataObject
Parameters:
name - A property name.
value - The new value. On most objects using null removes the property.
mode - The mode for the value. This is a bitwise OR of TRANSIENT and/or OVERRIDE. Using TRANSIENT specifies the value is to be marked transient (ie isTransient (name) will return true). Not all data object implementations support dynamic transience. OVERRIDE must be set if an existing value is to be overwritten: if not set and a value is already defined, then nothing is changed. The IDataObject.setValue (name, value) call corresponds to IDataBean.setValue (name, value, OVERRIDE).
See Also:
IDataObject.setValue(Object, Object)

getValue

public Object getValue(Object name)
Description copied from interface: IDataObject
Get the value of a given property.

Specified by:
getValue in interface IDataObject
Parameters:
name - The property "name" (may be any object).
Returns:
the value of a given property or null if the property is not defined.
See Also:
IDataObject.setValue(Object, Object), IDataObject.propertyIterator()

propertyIterator

public Iterator propertyIterator()
Description copied from interface: IDataObject
Get an iterator that scans over all currently defined properties.

Specified by:
propertyIterator in interface IDataObject
Returns:
An iterator that yields all defined property values (ie that would get a non-null result from IDataObject.getValue(Object)).
See Also:
IDataObject.getValue(Object), PropertyValueIterator

shallowClone

public IDataObject shallowClone()
                         throws UnsupportedOperationException
Description copied from interface: IDataObject
Shallow clone the object prior to being recusively "deep" cloned. This should return a new instance of the same class as the object suitable for receiving a series of setValue () calls to add copied properties from the original. Only state that would not be copied by the copying of all properties needs to be cloned by this method.

NOTE: Clients should not need to call this method: use DataObjects.deepClone(IDataObject) instead.

Specified by:
shallowClone in interface IDataObject
Overrides:
shallowClone in class AbstractDataObject
Returns:
A new object of the same type, with the same values as the original.
Throws:
UnsupportedOperationException - if the object or child object could not be cloned.
See Also:
DataObjects.deepClone(IDataObject)

isTransient

public boolean isTransient(Object name)
Description copied from interface: IDataObject
Test a property is transient (ie will not be preserved if the object is saved).

Specified by:
isTransient in interface IDataObject
Parameters:
name - The property name.
Returns:
boolean True if the property is transient.

getTypeInfo

public TypeInfo getTypeInfo()
Description copied from interface: IDataObject
Get the optional type information for this object. If the object has none, this will be null.

Specified by:
getTypeInfo in interface IDataObject
Specified by:
getTypeInfo in class AbstractDataObject
See Also:
TypeRegistry

propertyValueChanged

public void propertyValueChanged(PropertyEvent e)
Specified by:
propertyValueChanged in interface PropertyListener


Copyright © 2008 Commonwealth of Australia