dsto.dfc.databeans
Class SimpleDataObject

java.lang.Object
  extended by dsto.dfc.databeans.AbstractDataObject
      extended by dsto.dfc.databeans.SimpleDataObject
All Implemented Interfaces:
IDataObject, IDataObjectChildListener, Cloneable
Direct Known Subclasses:
FancyDataObject, PropertyFilter

public class SimpleDataObject
extends AbstractDataObject

Base class for simple IDataObject's that expose their state as public fields. Uses reflection to expose all public, non-static fields as IDataObject properties.

Author:
matthew
See Also:
DataObjects.fireChangedEvents(dsto.dfc.databeans.AbstractDataObject, dsto.dfc.databeans.AbstractDataObject)

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
SimpleDataObject()
           
 
Method Summary
protected  Collection getFieldNames()
          Get the current set of field names from this class.
 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).
 Iterator propertyIterator()
          Get an iterator that scans over all currently defined properties.
 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.
 
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, shallowClone, toString, unregisterValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleDataObject

public SimpleDataObject()
Method Detail

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

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.

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()

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).

Parameters:
name - The property name.
Returns:
boolean True if the property is transient.

propertyIterator

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

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

getFieldNames

protected Collection getFieldNames()
                            throws SecurityException
Get the current set of field names from this class.

Throws:
SecurityException


Copyright © 2008 Commonwealth of Australia