org.nuiton.util.beans.package-info Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nuiton-utils Show documentation
Show all versions of nuiton-utils Show documentation
Library of usefull classes to be used in any project.
/*
* #%L
* Nuiton Utils
* %%
* Copyright (C) 2004 - 2010 CodeLutin
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* .
* #L%
*/
/**
* Packages for all stuff of bean transformations (binder, and others...).
*
* This package contains two api :
*
* - the Binder api to copy objects
* - Some javabeans compiliant api
*
*
* The Binder api
*
* This api permits to some object properties from an object to another one.
*
* Obtain a binder
* A {@link org.nuiton.util.beans.Binder} contains a safe model named
* {@link org.nuiton.util.beans.Binder.BinderModel} which knows
* all properties that can be copied.
*
* To use this api, you have only to get a {@link org.nuiton.util.beans.Binder}
* object from the {@link org.nuiton.util.beans.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 {@link org.nuiton.util.beans.BinderModelBuilder}.
*
* Use a binder
* Once you have a binder, you use the {@link org.nuiton.util.beans.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
* {@link org.nuiton.util.beans.BinderModelBuilder} object to do this.
* then register your binder model into the
* {@link org.nuiton.util.beans.BinderFactory} using one of the method
* {@code 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
*
* {@link org.nuiton.util.beans.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
*/
package org.nuiton.util.beans;