Class MapTransformerImpl

    • Constructor Detail

      • MapTransformerImpl

        public MapTransformerImpl()
    • Method Detail

      • transform

        public <T,​K> java.util.Map<T,​K> transform​(java.util.Map<T,​K> sourceMap,
                                                              BeanTransformer beanTransformer)
        Copies all properties from a map to a new one applying the transformation function and mappings defined.
        Type Parameters:
        T - the key object type in the source map
        K - the elem object type in the source map
        Parameters:
        sourceMap - the source map
        beanTransformer - the bean transformer to use for the map elements transformation
        Returns:
        a copy of the source object into the destination object
      • transform

        public <T,​K,​R,​V> java.util.Map<R,​V> transform​(java.util.Map<T,​K> sourceMap,
                                                                              BeanTransformer beanTransformer,
                                                                              java.lang.Class<R> targetKeyType,
                                                                              java.lang.Class<V> targetElemType)
        Copies all properties from a map to a new one applying the transformation function and mappings defined.
        Type Parameters:
        T - the key object type in the source map
        K - the elem object type in the source map
        R - the key object type in the target map
        V - the elem object type in the target map
        Parameters:
        sourceMap - the source map
        beanTransformer - the bean transformer to use for the map elements transformation
        targetKeyType - the key type in the target map
        targetElemType - the elem type in the target map
        Returns:
        a copy of the source object into the destination object
      • transform

        public <T,​K> java.util.Map<T,​K> transform​(java.util.Map<T,​K> sourceMap)
        Copies all properties from a map to a new one applying the transformation function and mappings defined.
        Specified by:
        transform in interface MapTransformer
        Type Parameters:
        T - the key object type in the source map
        K - the elem object type in the source map
        Parameters:
        sourceMap - the source map
        Returns:
        a copy of the source object into the destination object
      • transform

        public <T,​K,​R,​V> java.util.Map<R,​V> transform​(java.util.Map<T,​K> sourceMap,
                                                                              java.lang.Class<R> targetKeyType,
                                                                              java.lang.Class<V> targetElemType)
        Copies all properties from a map to a new one applying the transformation function and mappings defined.
        Specified by:
        transform in interface MapTransformer
        Type Parameters:
        T - the key object type in the source map
        K - the elem object type in the source map
        R - the key object type in the target map
        V - the elem object type in the target map
        Parameters:
        sourceMap - the source map
        targetKeyType - the key type in the target map
        targetElemType - the elem type in the target map
        Returns:
        a copy of the source object into the destination object
      • withKeyTransformer

        public MapTransformer withKeyTransformer​(FieldTransformer... keyFieldTransformer)
        Initializes the transformer functions to apply on a Map key. The transformer function returns directly the field value.
        Specified by:
        withKeyTransformer in interface MapTransformer
        Parameters:
        keyFieldTransformer - the fields transformer function
        Returns:
        the Transformer instance
      • resetKeyTransformer

        public final void resetKeyTransformer()
        Removes all the configured key transformer.
        Specified by:
        resetKeyTransformer in interface MapTransformer