org.nuiton.topia.persistence.util
Interface Loador<E>

Type Parameters:
E - type of bean to load
All Superinterfaces:
Serializable
All Known Implementing Classes:
BeanPropertyLoador, EntityLoador, TopiaEntityBinder

public interface Loador<E>
extends Serializable

A simple contract to load an object from another one.

Author:
chemit

Method Summary
 void load(E from, E dst, boolean tech, String... propertyNames)
          Bind an entity to another.
 Map<String,Object> obtainProperties(E from, String... propertyNames)
          Obtain from an entity all data to bind to another one according the definition of the loador.
 

Method Detail

obtainProperties

Map<String,Object> obtainProperties(E from,
                                    String... propertyNames)
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 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).

Parameters:
from - the entity to bind
propertyNames - subset of properties to load
Returns:
the map of properties to bind from the given entity.

load

void load(E from,
          E dst,
          boolean tech,
          String... propertyNames)
Bind an entity to another.

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


Copyright © 2004-2010 CodeLutin. All Rights Reserved.