Package com.expediagroup.map.transformer
Interface MapTransformer
- All Superinterfaces:
Transformer<MapTransformer>
- All Known Implementing Classes:
MapTransformerImpl
public interface MapTransformer extends Transformer<MapTransformer>
Utility methods for populating
Map
elements via reflection.
The implementations are provided by MapTransformerImpl
.-
Method Summary
Modifier and Type Method Description void
resetKeyTransformer()
Removes all the configured key transformer.<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.<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.<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.<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.MapTransformer
withKeyTransformer(FieldTransformer... keyFieldTransformer)
Initializes the transformer functions to apply on a Map key.Methods inherited from interface com.expediagroup.transformer.Transformer
removeFieldMapping, removeFieldTransformer, reset, resetFieldsMapping, resetFieldsTransformer, withFieldMapping, withFieldTransformer
-
Method Details
-
transform
<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.- Type Parameters:
T
- the key object type in the source mapK
- the elem object type in the source map- Parameters:
sourceMap
- the source map- Returns:
- a copy of the source object into the destination object
- Throws:
java.lang.IllegalArgumentException
- if any parameter is invalid
-
transform
<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 mapK
- the elem object type in the source map- Parameters:
sourceMap
- the source mapbeanTransformer
- the bean transformer to use for the map elements transformation- Returns:
- a copy of the source object into the destination object
- Throws:
java.lang.IllegalArgumentException
- if any parameter is invalid
-
transform
<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.- Type Parameters:
T
- the key object type in the source mapK
- the elem object type in the source mapR
- the key object type in the target mapV
- the elem object type in the target map- Parameters:
sourceMap
- the source maptargetKeyType
- the key type in the target maptargetElemType
- the elem type in the target map- Returns:
- a copy of the source object into the destination object
- Throws:
java.lang.IllegalArgumentException
- if any parameter is invalid
-
transform
<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 mapK
- the elem object type in the source mapR
- the key object type in the target mapV
- the elem object type in the target map- Parameters:
sourceMap
- the source mapbeanTransformer
- the bean transformer to use for the map elements transformationtargetKeyType
- the key type in the target maptargetElemType
- the elem type in the target map- Returns:
- a copy of the source object into the destination object
- Throws:
java.lang.IllegalArgumentException
- if any parameter is invalid
-
withKeyTransformer
Initializes the transformer functions to apply on a Map key. The transformer function returns directly the field value.- Parameters:
keyFieldTransformer
- the fields transformer function- Returns:
- the
Transformer
instance
-
resetKeyTransformer
void resetKeyTransformer()Removes all the configured key transformer.
-