MultiValuedMap to transform objects that are added.
This class affects the MultiValuedMap put methods. Thus objects must be removed or searched for using their transformed form. For example, if the transformation converts Strings to Integers, you must use the Integer form to remove objects.
Note that TransformedMultiValuedMap is not synchronized and is not thread-safe.
| Modifier and Type | Field and Description |
|---|---|
| private final Transformer | keyTransformer
The key transformer |
| private static final long | serialVersionUID
Hides org. |
| private final Transformer | valueTransformer
The value transformer |
| Access | Constructor and Description |
|---|---|
| protected | TransformedMultiValuedMap(final MultiValuedMap<K, V>
the MultiValuedMap to decorate, may not be null map, final Transformer<? super K, ? extends K> the transformer to use for key conversion, null means no conversion keyTransformer, final Transformer<? super V, ? extends V> the transformer to use for value conversion, null means no conversion valueTransformer)Constructor that wraps (not copies). |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | put(final K
the key to store against key, final V the value to add to the collection at the key value)Overrides org. Implements org. |
| public boolean | putAll(final K
the key to store against key, final Iterable<? extends V> the values to add to the collection at the key, may not be null values)Overrides org. Implements org. |
| public boolean | putAll(final Map<? extends K, ? extends V>
mappings to be stored in this map, may not be null map)Overrides org. Implements org. |
| public boolean | putAll(final MultiValuedMap<? extends K, ? extends V>
mappings to be stored in this map, may not be null map)Overrides org. Implements org. |
| public static < the key type K, the value type V> TransformedMultiValuedMap | Returns: a new transformed MultiValuedMapthe MultiValuedMap to decorate, may not be null map, final Transformer<? super K, ? extends K> the transformer to use for key conversion, null means no conversion keyTransformer, final Transformer<? super V, ? extends V> the transformer to use for value conversion, null means no conversion valueTransformer)Factory method to create a transforming MultiValuedMap that will transform existing contents of the specified map. |
| public static < the key type K, the value type V> TransformedMultiValuedMap | Returns: a new transformed MultiValuedMapthe MultiValuedMap to decorate, may not be null map, final Transformer<? super K, ? extends K> the transformer to use for key conversion, null means no conversion keyTransformer, final Transformer<? super V, ? extends V> the transformer to use for value conversion, null means no conversion valueTransformer)Factory method to create a transforming MultiValuedMap. |
| protected K | |
| protected V | Returns: the transformed objectthe object to transform object)Transforms a value. |
| keyTransformer | back to summary |
|---|---|
| private final Transformer<? super K, ? extends K> keyTransformer The key transformer | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides org. Serialization Version | |
| valueTransformer | back to summary |
|---|---|
| private final Transformer<? super V, ? extends V> valueTransformer The value transformer | |
| TransformedMultiValuedMap | back to summary |
|---|---|
| protected TransformedMultiValuedMap(final MultiValuedMap<K, V> map, final Transformer<? super K, ? extends K> keyTransformer, final Transformer<? super V, ? extends V> valueTransformer) Constructor that wraps (not copies). If there are any elements already in the collection being decorated, they are NOT transformed.
| |
| put | back to summary |
|---|---|
| public boolean put(final K key, final V value) Overrides org. Implements org. Doc from org. Adds a key-value mapping to this multi-valued map.
Unlike a normal
The method will return
| |
| putAll | back to summary |
|---|---|
| public boolean putAll(final K key, final Iterable<? extends V> values) Overrides org. Implements org. Doc from org. Adds a mapping to the specified key for all values contained in the given Iterable. | |
| putAll | back to summary |
|---|---|
| public boolean putAll(final Map<? extends K, ? extends V> map) Overrides org. Implements org. Doc from org. Copies all mappings from the specified map to this multi-valued map (optional operation).
The effect of this call is equivalent to that of calling
The behavior of this operation is undefined if the specified map is modified while the operation is in progress. | |
| putAll | back to summary |
|---|---|
| public boolean putAll(final MultiValuedMap<? extends K, ? extends V> map) Overrides org. Implements org. Doc from org. Copies all mappings from the specified map to this multi-valued map (optional operation).
The effect of this call is equivalent to that of calling
The behavior of this operation is undefined if the specified map is modified while the operation is in progress.
| |
| transformedMap | back to summary |
|---|---|
| public static <K, V> TransformedMultiValuedMap Factory method to create a transforming MultiValuedMap that will transform existing contents of the specified map.
If there are any elements already in the map being decorated, they will
be transformed by this method. Contrast this with
| |
| transformingMap | back to summary |
|---|---|
| public static <K, V> TransformedMultiValuedMap Factory method to create a transforming MultiValuedMap.
If there are any elements already in the map being decorated, they are
NOT transformed. Contrast this with
| |
| transformKey | back to summary |
|---|---|
| protected K transformKey(final K object) Transforms a key. The transformer itself may throw an exception if necessary.
| |
| transformValue | back to summary |
|---|---|
| protected V transformValue(final V object) Transforms a value. The transformer itself may throw an exception if necessary.
| |