Class StrLookup.MapStrLookup<V>

  • Type Parameters:
    V - the type of the values supported by the lookup
    All Implemented Interfaces:
    StringLookup
    Enclosing class:
    StrLookup<V>

    static class StrLookup.MapStrLookup<V>
    extends StrLookup<V>
    Lookup implementation that uses a Map.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map<java.lang.String,​V> map
      Map keys are variable names and value.
    • Constructor Summary

      Constructors 
      Constructor Description
      MapStrLookup​(java.util.Map<java.lang.String,​V> map)
      Creates a new instance backed by a Map.
    • Field Detail

      • map

        private final java.util.Map<java.lang.String,​V> map
        Map keys are variable names and value.
    • Constructor Detail

      • MapStrLookup

        MapStrLookup​(java.util.Map<java.lang.String,​V> map)
        Creates a new instance backed by a Map.
        Parameters:
        map - the map of keys to values, may be null
    • Method Detail

      • lookup

        public java.lang.String lookup​(java.lang.String key)
        Looks up a String key to a String value using the map.

        If the map is null, then null is returned. The map result object is converted to a string using toString().

        Parameters:
        key - the key to be looked up, may be null
        Returns:
        The matching value, null if no match
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object