org.omnaest.utils.structure.map.adapter
Class MapToMapAdapter<KEY_FROM,VALUE_FROM,KEY_TO,VALUE_TO>

java.lang.Object
  extended by org.omnaest.utils.structure.map.MapAbstract<KEY_TO,VALUE_TO>
      extended by org.omnaest.utils.structure.map.adapter.MapToMapAdapter<KEY_FROM,VALUE_FROM,KEY_TO,VALUE_TO>
Type Parameters:
KEY_FROM -
VALUE_FROM -
KEY_TO -
VALUE_TO -
All Implemented Interfaces:
Serializable, Map<KEY_TO,VALUE_TO>
Direct Known Subclasses:
MapToMapAdapterForKey, MapToMapAdapterForValue

public class MapToMapAdapter<KEY_FROM,VALUE_FROM,KEY_TO,VALUE_TO>
extends MapAbstract<KEY_TO,VALUE_TO>

The MapToMapAdapter is a decorator and adapter which allows to access a given Map using other types for the key as well as for the value.

The adapter instance is always backed by the original Map and changes on both sides will be traversed to each other side.

Author:
Omnaest
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
MapToMapAdapter(Map<KEY_FROM,VALUE_FROM> sourceMap, ElementBidirectionalConverter<KEY_FROM,KEY_TO> elementBidirectionalConverterKey, ElementBidirectionalConverter<VALUE_FROM,VALUE_TO> elementBidirectionalConverterValue)
           
MapToMapAdapter(Map<KEY_FROM,VALUE_FROM> sourceMap, ElementConverter<KEY_FROM,KEY_TO> elementConverterKeySourceToAdapter, ElementConverter<KEY_TO,KEY_FROM> elementConverterKeyAdapterToSource, ElementConverter<VALUE_FROM,VALUE_TO> elementConverterValueSourceToAdapter, ElementConverter<VALUE_TO,VALUE_FROM> elementConverterValueAdapterToSource)
           
 
Method Summary
protected  KEY_TO convertKeyFromToKeyTo(KEY_FROM key_FROM)
           
protected  KEY_FROM convertKeyToToKeyFrom(KEY_TO key_TO)
           
protected  VALUE_TO convertValueFromToValueTo(VALUE_FROM value_FROM)
           
protected  VALUE_FROM convertValueToToValueFrom(VALUE_TO value_TO)
           
 VALUE_TO get(Object key)
           
 Set<KEY_TO> keySet()
           
 VALUE_TO put(KEY_TO key, VALUE_TO value)
           
 VALUE_TO remove(Object key)
           
 Collection<VALUE_TO> values()
           
 
Methods inherited from class org.omnaest.utils.structure.map.MapAbstract
clear, containsKey, containsValue, entrySet, isEmpty, putAll, size, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

MapToMapAdapter

public MapToMapAdapter(Map<KEY_FROM,VALUE_FROM> sourceMap,
                       ElementConverter<KEY_FROM,KEY_TO> elementConverterKeySourceToAdapter,
                       ElementConverter<KEY_TO,KEY_FROM> elementConverterKeyAdapterToSource,
                       ElementConverter<VALUE_FROM,VALUE_TO> elementConverterValueSourceToAdapter,
                       ElementConverter<VALUE_TO,VALUE_FROM> elementConverterValueAdapterToSource)

MapToMapAdapter

public MapToMapAdapter(Map<KEY_FROM,VALUE_FROM> sourceMap,
                       ElementBidirectionalConverter<KEY_FROM,KEY_TO> elementBidirectionalConverterKey,
                       ElementBidirectionalConverter<VALUE_FROM,VALUE_TO> elementBidirectionalConverterValue)
Method Detail

convertKeyFromToKeyTo

protected KEY_TO convertKeyFromToKeyTo(KEY_FROM key_FROM)

convertKeyToToKeyFrom

protected KEY_FROM convertKeyToToKeyFrom(KEY_TO key_TO)

convertValueFromToValueTo

protected VALUE_TO convertValueFromToValueTo(VALUE_FROM value_FROM)

convertValueToToValueFrom

protected VALUE_FROM convertValueToToValueFrom(VALUE_TO value_TO)

get

public VALUE_TO get(Object key)

put

public VALUE_TO put(KEY_TO key,
                    VALUE_TO value)

remove

public VALUE_TO remove(Object key)

keySet

public Set<KEY_TO> keySet()

values

public Collection<VALUE_TO> values()


Copyright © 2013. All Rights Reserved.