org.brains2b.data
Class DataHelper

java.lang.Object
  |
  +--org.brains2b.data.DataHelper

public final class DataHelper
extends java.lang.Object

DateHelper is a Library class which provides method(s) which provide support for working with data objects.

All methods are static and should have no interdependancy between methods.

See the javadoc for the individual methods for the uses of that function

Version:
0.10 [17-02-2004]
Author:
dennis@brains2b.nl

Constructor Summary
DataHelper()
           
 
Method Summary
static void copyDataObject(java.lang.Object source, java.lang.Object target)
          copy the content of one data object to another.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataHelper

public DataHelper()
Method Detail

copyDataObject

public static final void copyDataObject(java.lang.Object source,
                                        java.lang.Object target)
                                 throws CopyException
copy the content of one data object to another.

The objects do not have to be similar, but should be bean like in that they have getters and setters for the data they contain The data object data is copied by finding all the getters from the source and copy it to the setter of another object. This does mean datatypes should be equal.

There is no strictness is copying. All methods that follow these rules will be copied. If the source has more accessors than the target these members will be left empty. If the target has less or dissimilar methods the data will be left as it was found.

getters should start with get and have no parameters, setters should start with set and take one parameter.

Parameters:
source - Object, where the data should be copied from, cannot be null
target - Object, where the data should be copied to, cannot be null
Throws:
CopyException - thrown if the data cannot be copied between objects usually this happens when accessors have the same name but use a different datatype.