|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.marringtons.object.DTO
This class provides facilities to deep copy data from one object to another. In the Adept library a DTO is any plain old Java object (pojo) used for transferring data from one class, package or module to another. The core requirement for a DTO is being able to load and extract data. To do this create a DTO object defining the objects to be played with and optionally a map of field names to copy.
dto = new DTO( left, right, new Object[] {"p1", "param1", "p2", "param2"});
dto = new DTO( left, right);
dto.copy( right, left);
dto.copy( left, right);
right = (Right) dto.copy( left);
left = (Left) dto.copy( right);
| Constructor Summary | |
DTO(Object left,
Object right)
Create a DTO to transfer data to and from a DAO to any other sort of object. |
|
DTO(Object left,
Object right,
Map fieldMap)
Create a DTO to transfer data to and from a DAO to any other sort of object. |
|
| Method Summary | |
Object |
copy(Object from)
Copy data between one object and another where the field names match. |
Object |
copy(Object to,
Object from)
Copy data between one object and another where the field names match. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public DTO(Object left,
Object right)
dto = new DTO( new LeftObject(), new RightObject());
left - DAO or general object.right - DAO or general object.
public DTO(Object left,
Object right,
Map fieldMap)
dto = new DTO( new LeftObject(), new RightObject(), Maps.load( new Object[]
{
"integer", "integer",
"aLong", "anotherLong",
}));
left - DAO or general object.right - DAO or general object.fieldMap - Map of fields to copy from source to target.| Method Detail |
public Object copy(Object to,
Object from)
dto = new DTO( left, right); dto.copy( right, left); dto.copy( left, right);
to - object to copy to or null to create a new one with a default constructor.from - existing object to copy from.
public Object copy(Object from)
dto = new DTO( left, right); left = (LeftObject) dto.copy( right); right = (RightObject) dto.copy( left);
from - existing object to copy from.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||