dsto.dfc.databeans
Class SimpleJavaDataBean

java.lang.Object
  extended by dsto.dfc.databeans.AbstractDataObject
      extended by dsto.dfc.databeans.AbstractDataBean
          extended by dsto.dfc.databeans.SimpleJavaDataBean
All Implemented Interfaces:
IDataBean, IDataObject, IDataObjectChildListener, PropertyChangeListener, Cloneable, EventListener

public class SimpleJavaDataBean
extends AbstractDataBean
implements PropertyChangeListener

Direct IDataBean adapter for a JavaBean. Does not handle default properties or the fancy stuff that JavaDataBean provides.

Version:
$Revision$
Author:
mpp

Field Summary
 
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
SimpleJavaDataBean(Object bean)
          Constructor for DataBeanAdapter.
 
Method Summary
 void dispose()
           
 Object getBean()
           
 Object getDefaultValue(String name)
           
 String[] getPropertyNames()
          Databean's only have strings as their property names.
 TypeInfo getTypeInfo()
          The default implementation uses TypeRegistry.peekTypeInfo(Class)to see whether any type info is registered for the class.
 Object getValue(Object name)
          Get the value of a given property.
 boolean isTransient(Object name)
          Test a property is transient (ie will not be preserved if the object is saved).
 void propertyChange(PropertyChangeEvent e)
           
 Iterator propertyIterator()
          Get an iterator that scans over all currently defined properties.
 void setToDefaultValue(String name)
           
 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.
 void setValue(String name, Object value, int mode)
           
 IDataObject shallowClone()
          Shallow clone the object prior to being recusively "deep" cloned.
 
Methods inherited from class dsto.dfc.databeans.AbstractDataBean
setValue, setValue, setValue, setValue, setValue, setValue, setValue
 
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.IDataBean
getBeanValue, getBooleanValue, getCharValue, getDoubleValue, getFloatValue, getIntValue, getLongValue, getObjectValue, getStringValue, setValue, setValue, setValue, setValue, setValue, setValue
 
Methods inherited from interface dsto.dfc.databeans.IDataObject
addPropertyListener, getPropertyListeners, removePropertyListener
 

Constructor Detail

SimpleJavaDataBean

public SimpleJavaDataBean(Object bean)
                   throws IllegalArgumentException
Constructor for DataBeanAdapter.

Throws:
IllegalArgumentException
Method Detail

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)

dispose

public void dispose()

getBean

public Object getBean()

getTypeInfo

public TypeInfo getTypeInfo()
The default implementation uses TypeRegistry.peekTypeInfo(Class)to see whether any type info is registered for the class.

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

getPropertyNames

public String[] getPropertyNames()
Description copied from interface: IDataBean
Databean's only have strings as their property names. This is a shortcut to get the property names for which getValue () would return a non-null value.

Specified by:
getPropertyNames in interface IDataBean

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

setValue

public void setValue(String name,
                     Object value,
                     int mode)

getDefaultValue

public Object getDefaultValue(String name)

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.

setToDefaultValue

public void setToDefaultValue(String name)

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)
                throws IllegalArgumentException
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.
Throws:
IllegalArgumentException
See Also:
IDataObject.setValue(Object, Object), IDataObject.propertyIterator()

propertyChange

public void propertyChange(PropertyChangeEvent e)
Specified by:
propertyChange in interface PropertyChangeListener


Copyright © 2008 Commonwealth of Australia