org.jaffa.beans.moulding.data.domain
Class DomainDAO

java.lang.Object
  extended byorg.jaffa.beans.moulding.data.domain.DomainDAO
Direct Known Subclasses:
Generic

public abstract class DomainDAO
extends Object

This is the base class for all Domain Data Access Objects.

It provides a default implementation of the PropertyChange function from the Java Bean specification, which keeps track of which properties in the Bean have been modified since construction, or since the last clearChanges()

It therefore provides (for the bean moulding framework) a way to infer if a value has been passed, which can be used to see if a field value should be moulded from the source to target bean.

Version:
1.0
Author:
PaulE

Field Summary
protected  PropertyChangeSupport propertyChangeSupport
          Utility field used by bound properties.
 
Constructor Summary
DomainDAO()
          Creates a new instance of DAO
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener l)
          Adds a PropertyChangeListener to the listener list.
 void clearChanges()
          Clear all the changes on this bean.
 Object getOriginalValue(String property)
          Get the original value for this field, throw an error if this field has no changed, so you should consider first checking with the hasChanged(String) method
 boolean hasChanged(String property)
          Has the specified bean property been changed since the bean was created or last cleared
 void removePropertyChangeListener(PropertyChangeListener l)
          Removes a PropertyChangeListener from the listener list.
 String toString()
          Converts the current contents of the bean to a multi-line nested output string, listing all the bean's properties.
 String toString(List objectStack)
          Converts the current contents of the bean to a multi-line nested output string, listing all the bean's properties.
abstract  void validate()
          This is called prior to a domain DAO being used in a service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

propertyChangeSupport

protected PropertyChangeSupport propertyChangeSupport
Utility field used by bound properties.

Constructor Detail

DomainDAO

public DomainDAO()
Creates a new instance of DAO

Method Detail

addPropertyChangeListener

public final void addPropertyChangeListener(PropertyChangeListener l)
Adds a PropertyChangeListener to the listener list.

Parameters:
l - The listener to add.

removePropertyChangeListener

public final void removePropertyChangeListener(PropertyChangeListener l)
Removes a PropertyChangeListener from the listener list.

Parameters:
l - The listener to remove.

clearChanges

public void clearChanges()
Clear all the changes on this bean. Will cause all future calls to hasChanged(String) to return false


hasChanged

public boolean hasChanged(String property)
Has the specified bean property been changed since the bean was created or last cleared

Parameters:
property - Name of bean property to check
Returns:
true if the property has been modified

getOriginalValue

public Object getOriginalValue(String property)
                        throws NoSuchFieldException
Get the original value for this field, throw an error if this field has no changed, so you should consider first checking with the hasChanged(String) method

Parameters:
property - Name of bean property to check
Returns:
The object representing the original values. Primitives are return as their Object counterparts.
Throws:
NoSuchFieldException - Throw if the property has not been changed, or does not exist.

validate

public abstract void validate()
                       throws ApplicationExceptions,
                              FrameworkException
This is called prior to a domain DAO being used in a service. This is only called on the top level DAO of a DAO Graph, so this method should roll up lower level validations. The DAO is assumed to be valid if no exception is thrown.

Throws:
ApplicationExceptions - Contains an list of possible business logic exceptions that caused the validation to fail
FrameworkException - Thrown if there is an environment/runtime problem that prevented the validation from being performed.

toString

public String toString()
Converts the current contents of the bean to a multi-line nested output string, listing all the bean's properties.

Property names that are suffixed with an asterisk (*) indicate that the value hasChanged().

Returns:
test string listing the beans contents

toString

public String toString(List objectStack)
Converts the current contents of the bean to a multi-line nested output string, listing all the bean's properties.

Property names that are suffixed with an asterisk (*) indicate that the value hasChanged().

Returns:
test string listing the beans contents


Copyright © 2002-2004 JAFFA Project.