Package org.nuiton.util.beans

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

See:
          Description

Class Summary
BeanMonitor A monitor of beans.
BeanUtil Usefull methods around the PropertyChangeListener.
Binder<I,O> A binder permits to copy some properties from an object to another one.
Binder.BinderModel<S,T> Model of a Binder.
BinderBuilder Deprecated. since 1.5.3, prefer use the BinderModelBuilder instead, will be removed in version 2.0
BinderFactory Factory of Binder.
BinderFactory.BindelModelEntryMap  
BinderFactory.BinderModelEntry Definition of an binder model entry (source and target types + context name).
BinderModelBuilder<S,T> Class to create a new Binder.BinderModel.
BinderProvider Deprecated. since 1.5.3, use now the BinderFactory instead, will be remove in version 1.6.
BinderProvider.BinderEntry Definition of an binder entry (source and target types + context name).
 

Enum Summary
Binder.CollectionStrategy Types of loading of collections.
 

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 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 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 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 exalanations will come soon, meanwhile you can see the test class :
 org.nuiton.util.beans.BeanMonitorTest
 

Since:
1.1.5


Copyright © 2004-2010 CodeLutin. All Rights Reserved.