|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nuiton.util.beans.Binder<I,O>
I - the source bean typeO - the destination bean typepublic class Binder<I,O>
A binder permits to copy some properties from an object to another
one.
BinderModel which contains the mapping of properties
to transfert from the source object to the destination object.
Use the method copy(Object, Object,String...) to transfert properties.
Use the method obtainProperties(Object,String...) to obtain
| Field Summary | |
|---|---|
protected BinderModel<I,O> |
model
the model of the binder |
| Constructor Summary | |
|---|---|
Binder()
|
|
| Method Summary | |
|---|---|
void |
copy(I source,
O target,
String... propertyNames)
Copy properties from a source bean to a destination one according to the model of the binder. |
protected BinderModel<I,O> |
getModel()
Get the model of the binder. |
protected String[] |
getProperties(String... propertyNames)
Obtain the properties, if none is given in propertyNames
parameter, will use all property names defined in binder's model,
otherwise, check that all given property names are safe (registred in
binder's model). |
Map<String,Object> |
obtainProperties(I source,
String... propertyNames)
Obtain from the given object all properties registred in the binder model. |
protected void |
setModel(BinderModel<?,?> model)
Set the model of the binder. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected BinderModel<I,O> model
| Constructor Detail |
|---|
public Binder()
| Method Detail |
|---|
public Map<String,Object> obtainProperties(I source,
String... propertyNames)
source - the bean to readpropertyNames - subset of properties to load
from is null.
public void copy(I source,
O target,
String... propertyNames)
throws NullPointerException
from object is null, then null values
will be set to mapped properties into dst
source - the bean to readtarget - the bean to writepropertyNames - optional subset of properties to copy (if none is
specifed, will use all the properties defined in
binder)
NullPointerException - if target parameter is nullprotected String[] getProperties(String... propertyNames)
propertyNames
parameter, will use all property names defined in binder's model,
otherwise, check that all given property names are safe (registred in
binder's model).
propertyNames - optional subset of properties to get
protected BinderModel<I,O> getModel()
protected void setModel(BinderModel<?,?> model)
model - the model of the binder
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||