Interface Loador<E>
- Type Parameters:
E- type of bean to load
- All Superinterfaces:
java.io.Serializable
- All Known Implementing Classes:
TopiaEntityBinder
public interface Loador<E>
extends java.io.Serializable
A simple contract to load an object from another one.
- Author:
- tchemit <chemit@codelutin.com>
-
Method Summary
Modifier and Type Method Description java.lang.Class<E>getSourceType()Obtains the type of the entity.voidload(E from, E dst, boolean tech, java.lang.String... propertyNames)Bind an entity to another.java.util.Map<java.lang.String,java.lang.Object>obtainProperties(E from, java.lang.String... propertyNames)Obtain from an entity all data to bind to another one according the definition of the loador.
-
Method Details
-
getSourceType
java.lang.Class<E> getSourceType()Obtains the type of the entity.- Returns:
- the type of entity
-
obtainProperties
java.util.Map<java.lang.String,java.lang.Object> obtainProperties(E from, java.lang.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 theload(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 bindpropertyNames- subset of properties to load- Returns:
- the map of properties to bind from the given entity.
-
load
Bind an entity to another.- Parameters:
from- the source entitydst- the destination entitytech- a flag to bind or not the technical values of the entity (says TopiaId, TopiaVersion and TopiaCreateDate).propertyNames- subset of properties to load
-