Class AbstractModelConverter<S,T>

  • Type Parameters:
    S - the type of the input object
    T - 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>
    Abstract ModelConverter implementation.
    Since:
    2.0.0
    Author:
    Wouter Eerdekens, Marcel Overdijk, Rutger Lubbers, Paul Klos
    • Constructor Detail

      • AbstractModelConverter

        public AbstractModelConverter​(Class<T> targetType)
        Parameters:
        targetType - the target type
    • Method Detail

      • convert

        public T convert​(S source)
        Converts the given source object into a new instance of target object.
        Specified by:
        convert in interface ModelConverter<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:
        convert in interface ModelConverter<S,T>
        Parameters:
        objects - the object, must not be null.
        Returns:
        the target objects
      • instantiateTargetObject

        protected T instantiateTargetObject​(S source)
        Instantiates the domain object.
        Parameters:
        source - the source
        Returns:
        the target object