Skip navigation links

Package org.nuiton.util.beans

Packages for all stuff of bean transformations (binder, and others...).

See: Description

Package org.nuiton.util.beans Description

Packages for all stuff of bean transformations (binder, and others...). This package contains two api :

The Binder api

This api permits to some object properties from an object to another one.

Obtain a binder

A Binder contains a safe model named Binder.BinderModel which knows all properties that can be copied.

To use this api, you have only to get a Binder object from the BinderFactory like this :
 Binder<A, A> binder = BinderFactory.newBinder(A.class);
 
It is also possible to build a more sofisticated binder which will only copy some properties, using the BinderModelBuilder.

Use a binder

Once you have a binder, you use the Binder api : To copy all properties from an object to another one :
 binder.copy(source, target);
 
To copy just some properties from an object to another one :
 binder.copy(source, target, "propertyOne", "propertyTwo");
 
To copy all properties except some :
 binder.copyExcluding(source, target, "propertyToExeclude");
 
To obtain some properties from an object, use the following code :
 Map<String, Object> properties = binder.obtainProperties(source, "propertyOne", "propertyTwo");
 

Building a new BinderModel

In two words, you have to use the BinderModelBuilder object to do this. then register your binder model into the BinderFactory using one of the method org.nuiton.util.beans.BinderFactory#registerBinderModel(XXX).

More explainations will come soon...

You can go and look on the unit tests which describe it pretty well :) :

 org.nuiton.util.beans.BinderModelBuilderTest
 

JavaBeans api

BeanMonitor class

This object permits to listen javaBeans and keep modifications made on a bean. More explanations will come soon, meanwhile you can see the test class :
 org.nuiton.util.beans.BeanMonitorTest
 
Since:
1.1.5
Skip navigation links

Copyright © 2004–2020 CodeLutin. All rights reserved.