org.nuiton.topia.persistence.util
Class BeanPropertyLoador<E>

java.lang.Object
  extended by org.nuiton.topia.persistence.util.BeanPropertyLoador<E>
Type Parameters:
E - type of bean to bind
All Implemented Interfaces:
Serializable, Loador<E>
Direct Known Subclasses:
EntityLoador

Deprecated. since 2.3.0, prefer use the TopiaEntityBinder

@Deprecated
public class BeanPropertyLoador<E>
extends Object
implements Loador<E>

A implementation fo the Loador contract using PropertyDescriptor.

Some factory methods are defined to simplify the generic cast, prefer used them instead of the (protected) constructor.

Author:
tchemit < chemit@codelutin.com >
See Also:
Serialized Form

Field Summary
protected  PropertyDescriptor[] descriptors
          Deprecated.  
protected  Class<E> klass
          Deprecated.  
protected  List<String> properties
          Deprecated.  
 
Constructor Summary
protected BeanPropertyLoador(Class<E> klass, String... properties)
          Deprecated.  
 
Method Summary
protected  void checkProperties()
          Deprecated.  
 PropertyDescriptor[] getDescriptors()
          Deprecated.  
protected static Object getNullValue(Class<?> type)
          Deprecated. use TopiaEntityHelper.getNullValue(Class)
 List<String> getProperties()
          Deprecated.  
static boolean isNullValue(Object value)
          Deprecated. use TopiaEntityHelper.isNullValue(Object)
 void load(E from, E dst, boolean tech, String... propertyNames)
          Deprecated. Bind an entity to another.
static
<E> BeanPropertyLoador<E>
newLoador(Class<E> klass, String... properties)
          Deprecated.  
 Map<String,Object> obtainProperties(E from, String... propertyNames)
          Deprecated. Obtain from an entity all data to bind to another one according the definition of the loador.
protected  void setProperty(E dst, PropertyDescriptor descriptor, Object value)
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

properties

protected List<String> properties
Deprecated. 

descriptors

protected transient PropertyDescriptor[] descriptors
Deprecated. 

klass

protected Class<E> klass
Deprecated. 
Constructor Detail

BeanPropertyLoador

protected BeanPropertyLoador(Class<E> klass,
                             String... properties)
Deprecated. 
Method Detail

newLoador

public static <E> BeanPropertyLoador<E> newLoador(Class<E> klass,
                                                  String... properties)
Deprecated. 

getProperties

public List<String> getProperties()
Deprecated. 

getDescriptors

public PropertyDescriptor[] getDescriptors()
Deprecated. 

obtainProperties

public Map<String,Object> obtainProperties(E from,
                                           String... propertyNames)
Deprecated. 
Description copied from interface: Loador
Obtain from an entity all data to bind to another one according the definition of the loador.

This method is usefull when you can not directly used the Loador.load(Object, Object, boolean, String...) method.

For example, when an entity has a immutable business key (says with an hibernate naturalId for example), and that you want to create the data in a db, you must give all the properties at the create time so this method allow you to do it).

Specified by:
obtainProperties in interface Loador<E>
Parameters:
from - the entity to bind
propertyNames - subset of properties to load
Returns:
the map of properties to bind from the given entity.

load

public void load(E from,
                 E dst,
                 boolean tech,
                 String... propertyNames)
Deprecated. 
Description copied from interface: Loador
Bind an entity to another.

Specified by:
load in interface Loador<E>
Parameters:
from - the source entity
dst - the destination entity
tech - a flag to bind or not the technical values of the entity (says TopiaId, TopiaVersion and TopiaCreateDate).
propertyNames - subset of properties to load

setProperty

protected void setProperty(E dst,
                           PropertyDescriptor descriptor,
                           Object value)
Deprecated. 

getNullValue

@Deprecated
protected static Object getNullValue(Class<?> type)
Deprecated. use TopiaEntityHelper.getNullValue(Class)

Parameters:
type - type to test
Returns:
the null value for the given type

isNullValue

@Deprecated
public static boolean isNullValue(Object value)
Deprecated. use TopiaEntityHelper.isNullValue(Object)

Parameters:
value - the value to test
Returns:
true if value is null

checkProperties

protected void checkProperties()
Deprecated. 


Copyright © 2004-2010 CodeLutin. All Rights Reserved.