Class AutoConvertingMap<K,​V>

  • Type Parameters:
    K -
    V -
    All Implemented Interfaces:
    java.util.Map<K,​V>

    @XStreamConverter(com.funnelback.publicui.xml.AutoConvertingMapXStreamConverter.class)
    public class AutoConvertingMap<K,​V>
    extends DelegateMap<K,​V>
    A map that can auto convert the key from one type to the expected type. For example if you have a map that is Map but people are using Integer keys you can use this to convert the Integer key to a String key.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  AutoConvertingMap.Converter<T>
      Converter to convert from some other type to the expected type.
      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Field Detail

      • log

        private static final org.apache.logging.log4j.Logger log
      • note

        private final java.lang.String note
    • Constructor Detail

      • AutoConvertingMap

        public AutoConvertingMap​(AutoConvertingMap.Converter<K> keyConverter,
                                 java.lang.String note,
                                 java.util.Map<K,​V> underlyingMap)
    • Method Detail

      • convertKey

        private K convertKey​(K key)
      • put

        public V put​(K key,
                     V value)
        Specified by:
        put in interface java.util.Map<K,​V>
        Overrides:
        put in class DelegateMap<K,​V>
      • get

        public V get​(java.lang.Object key)
        Specified by:
        get in interface java.util.Map<K,​V>
        Overrides:
        get in class DelegateMap<K,​V>
      • containsKey

        public boolean containsKey​(java.lang.Object key)
        Specified by:
        containsKey in interface java.util.Map<K,​V>
        Overrides:
        containsKey in class DelegateMap<K,​V>
      • remove

        public V remove​(java.lang.Object key)
        Specified by:
        remove in interface java.util.Map<K,​V>
        Overrides:
        remove in class DelegateMap<K,​V>
      • putAll

        public void putAll​(java.util.Map<? extends K,​? extends V> m)
        Specified by:
        putAll in interface java.util.Map<K,​V>
        Overrides:
        putAll in class DelegateMap<K,​V>