jve.generated
Class ObjectReference

java.lang.Object
  extended byjve.generated.ObjectReference
All Implemented Interfaces:
IBoundObject
Direct Known Subclasses:
BasicDataObject, DataSourceDataRows

public class ObjectReference
extends java.lang.Object
implements IBoundObject

This class is a wrapper that references an Object: boundObject. The boundObject is noted by [Object, property]. If a property is given, the boundObject is Object.getProperty(), eithewise it boundObject == Object. A property can be nested. i.e., the boundObject for [Object, "foo.bar"] is Object.getFoo().getBar()

The ObjectReference class provide property resolution, and event modeling support for bounded properties.


Field Summary
static boolean debug
           
 
Fields inherited from interface jve.generated.IBoundObject
DELIMITER, PROPERTY_OBJ_CHANGED
 
Constructor Summary
ObjectReference()
          Construct an uninitialized ObjectReference
ObjectReference(java.lang.Object source, java.lang.String property)
          Construct an ObjectReference initialized with its source object and property.
 
Method Summary
 void actionPerformed(IActionBinder action)
          Notify an argument of an action.
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
          Add a propertyChangeListener that will listen to property changes on the object being referenced (the final object, including the value of subproperties).
 java.lang.Object getObject()
          Get the value of this ObjectReference.
 java.lang.String getProperty()
          Return the property of the source object being referenced by this ObjectReference
 java.lang.Object getSourceObject()
          Get the source object that's bound to this ObjectReference
 java.lang.Class getType()
          Get the type of the ObjectReference.
 void refresh()
          Refresh this ObjectReference.
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
          Remove an existing property change listener from the listener list.
 void setProperty(java.lang.String property)
          Set the property to be used for this ObjectReference.
 void setSourceObject(java.lang.Object obj)
          Set the source object this ObjectReference will be bound to.
 void setSourceObject(java.lang.Object object, java.lang.String property)
          Set the source object and target property simultaneously.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

debug

public static boolean debug
Constructor Detail

ObjectReference

public ObjectReference()
Construct an uninitialized ObjectReference


ObjectReference

public ObjectReference(java.lang.Object source,
                       java.lang.String property)
Construct an ObjectReference initialized with its source object and property.

Parameters:
source - the source object
property - a property on the source object (may be null)
Method Detail

getProperty

public java.lang.String getProperty()
Return the property of the source object being referenced by this ObjectReference

Specified by:
getProperty in interface IBoundObject
Returns:
Returns the property.

refresh

public void refresh()
Refresh this ObjectReference. This implementation will update the ObjectReference's cached PropertyHelper.

Specified by:
refresh in interface IBoundObject

setProperty

public void setProperty(java.lang.String property)
Set the property to be used for this ObjectReference. If the property is null, the ObjectReference will reference the source object directly.

Specified by:
setProperty in interface IBoundObject
Parameters:
property - is the property to use on #getObject

getSourceObject

public java.lang.Object getSourceObject()
Get the source object that's bound to this ObjectReference

Specified by:
getSourceObject in interface IBoundObject
Returns:
the source object

setSourceObject

public void setSourceObject(java.lang.Object obj)
Set the source object this ObjectReference will be bound to.

Specified by:
setSourceObject in interface IBoundObject
Parameters:
obj - the source object

setSourceObject

public void setSourceObject(java.lang.Object object,
                            java.lang.String property)
Description copied from interface: IBoundObject
Set the source object and target property simultaneously. Using this method will prevent multiple event firings of changing both the sourceObject and property separately.

Specified by:
setSourceObject in interface IBoundObject
Parameters:
object - the source object
property - the target property

getObject

public java.lang.Object getObject()
Get the value of this ObjectReference. If the ObjectReference has a sourceObject and property set, the return value will be the result of calling sourceObject.get[Property](). Otherwise the return value will be the sourceObject.

Specified by:
getObject in interface IBoundObject
Returns:
resolved object reference.

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Add a propertyChangeListener that will listen to property changes on the object being referenced (the final object, including the value of subproperties).

Specified by:
addPropertyChangeListener in interface IBoundObject
Parameters:
l - the listener to add.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Remove an existing property change listener from the listener list.

Specified by:
removePropertyChangeListener in interface IBoundObject
Parameters:
l - the listener to remove.

actionPerformed

public void actionPerformed(IActionBinder action)
Notify an argument of an action. This action will be delegated to the sourceObject if it is a IBoundObject.

Specified by:
actionPerformed in interface IBoundObject
Parameters:
action - the action that has occurred.
See Also:
IActionBinder

getType

public java.lang.Class getType()
                        throws java.lang.IllegalStateException
Get the type of the ObjectReference. If the property is set, this will be the return type of the sourceObject.get[Property]() method. Otherwise it will be the type of the sourceObject.

Specified by:
getType in interface IBoundObject
Returns:
the Class type of the configured object. If it is an array or a List, it will return the type of the elements that comprises the array or List rather than the type array or List type.
Throws:
java.lang.IllegalStateException - if the target object can not be determined due to a miss-configuration. The exception includes a message denoting the reason.

toString

public java.lang.String toString()