Package com.hotels.beans.populator
Class Populator<O>
- java.lang.Object
-
- com.hotels.beans.populator.Populator<O>
-
- Type Parameters:
O
- the type of the object to get populated.
public abstract class Populator<O> extends Object
Populator for collection or map objects.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <K> O
getPopulatedObject(Class<K> targetClass, String fieldName, O fieldValue)
Populates the array of the target object with the values into the source object.protected abstract O
getPopulatedObject(Field field, O fieldValue)
Populates the array of the target object with the values into the source object.
-
-
-
Method Detail
-
getPopulatedObject
protected abstract O getPopulatedObject(Field field, O fieldValue)
Populates the array of the target object with the values into the source object.- Parameters:
field
- the field to be populatedfieldValue
- the source object from which extract the values- Returns:
- a populated list of elements
-
getPopulatedObject
public final <K> O getPopulatedObject(Class<K> targetClass, String fieldName, O fieldValue)
Populates the array of the target object with the values into the source object.- Type Parameters:
K
- the target object type- Parameters:
targetClass
- the destination object classfieldName
- the field to be populatedfieldValue
- the source object from which extract the values- Returns:
- a populated list of elements
-
-