Package org.hawaiiframework.converter
Class AbstractModelConverter<S,T>
- java.lang.Object
-
- org.hawaiiframework.converter.AbstractModelConverter<S,T>
-
- Type Parameters:
S- the type of the input objectT- the type of the domain object
- All Implemented Interfaces:
ModelConverter<S,T>
- Direct Known Subclasses:
ValidationErrorResourceAssembler
public abstract class AbstractModelConverter<S,T> extends Object implements ModelConverter<S,T>
AbstractModelConverterimplementation.- Since:
- 2.0.0
- Author:
- Wouter Eerdekens, Marcel Overdijk, Rutger Lubbers, Paul Klos
-
-
Constructor Summary
Constructors Constructor Description AbstractModelConverter(Class<T> targetType)Constructs aAbstractModelConverter.AbstractModelConverter(Class<T> targetType, NullListConversionStrategy<T> nullListConversionStrategy)Constructs aAbstractModelConverter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<T>convert(Iterable<? extends S> objects)Converts all given source objects into target objects.Tconvert(S source)Converts the given source object into a new instance of target object.protected TinstantiateTargetObject(S source)Instantiates the domain object.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hawaiiframework.converter.ModelConverter
convert
-
-
-
-
Constructor Detail
-
AbstractModelConverter
public AbstractModelConverter(Class<T> targetType)
Constructs aAbstractModelConverter.- Parameters:
targetType- the target type
-
AbstractModelConverter
public AbstractModelConverter(Class<T> targetType, NullListConversionStrategy<T> nullListConversionStrategy)
Constructs aAbstractModelConverter.The null list conversion strategy to be used can be supplied, or one of the supplied default methods can be used. See:
- Parameters:
targetType- the target type.nullListConversionStrategy- the strategy how to handle null lists.
-
-
Method Detail
-
convert
public T convert(S source)
Converts the given source object into a new instance of target object.- Specified by:
convertin interfaceModelConverter<S,T>- Parameters:
source- the source object- Returns:
- the target object
-
convert
public List<T> convert(Iterable<? extends S> objects)
Converts all given source objects into target objects.- Specified by:
convertin interfaceModelConverter<S,T>- Parameters:
objects- the object, must not be null.- Returns:
- the target objects
-
-