Class AbstractBeanMapper

    • Constructor Detail

      • AbstractBeanMapper

        public AbstractBeanMapper()
        The constructor.
    • Method Detail

      • mapTypesafe

        public <API,​S extends API,​T extends API> T mapTypesafe​(Class<API> apiClass,
                                                                           S source,
                                                                           Class<T> targetClass)
        Description copied from interface: BeanMapper
        A type-safe variant of BeanMapper.map(Object, Class) to prevent accidental abuse (e.g. mapping of apples to bananas).
        Specified by:
        mapTypesafe in interface BeanMapper
        Type Parameters:
        API - is a common super-type (interface) of source and targetType.
        S - is the generic type of source.
        T - is the generic type to convert to (target).
        Parameters:
        apiClass - is the Class reflecting the <API>.
        source - is the object to convert.
        targetClass - is the Class reflecting the type to convert to.
        Returns:
        the converted object. Will be null if source is null.
      • mapList

        public <T> List<T> mapList​(List<?> source,
                                   Class<T> targetClass,
                                   boolean suppressNullValues)
        Description copied from interface: BeanMapper
        Creates a new List with the mapped bean for each entry of the given List.
        Specified by:
        mapList in interface BeanMapper
        Type Parameters:
        T - is the generic type to convert the List entries to.
        Parameters:
        source - is the List with the source objects.
        targetClass - is the Class reflecting the type to convert each List entry to.
        suppressNullValues - true if null values shall be suppressed/omitted in the resulting List, false otherwise.
        Returns:
        the List with the converted objects. Will be empty is source is empty or null.
      • mapSet

        public <T> Set<T> mapSet​(Set<?> source,
                                 Class<T> targetClass)
        Description copied from interface: BeanMapper
        Creates a new Set with the mapped bean for each entry of the given Set. Uses false for suppressNullValues (see BeanMapper.mapSet(Set, Class, boolean)).
        Specified by:
        mapSet in interface BeanMapper
        Type Parameters:
        T - is the generic type to convert the Set entries to.
        Parameters:
        source - is the Set with the source objects.
        targetClass - is the Class reflecting the type to convert each Set entry to.
        Returns:
        the Set with the converted objects. Will be empty is source is empty or null.
      • mapSet

        public <T> Set<T> mapSet​(Set<?> source,
                                 Class<T> targetClass,
                                 boolean suppressNullValues)
        Description copied from interface: BeanMapper
        Creates a new Set with the mapped bean for each entry of the given Set.
        Specified by:
        mapSet in interface BeanMapper
        Type Parameters:
        T - is the generic type to convert the Set entries to.
        Parameters:
        source - is the Set with the source objects.
        targetClass - is the Class reflecting the type to convert each Set entry to.
        suppressNullValues - true if null values shall be suppressed/omitted in the resulting Set, false otherwise.
        Returns:
        the Set with the converted objects. Will be empty is source is empty or null.