Class StrLookup.MapStrLookup<V>

java.lang.Object
org.apache.commons.lang3.text.StrLookup<V>
org.apache.commons.lang3.text.StrLookup.MapStrLookup<V>
Type Parameters:
V - the type of mapped values.
Enclosing class:
StrLookup<V>

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

    • map

      private final Map<String,V> map
      Map keys are variable names and value.
  • Constructor Details

    • MapStrLookup

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

    • lookup

      public String lookup(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().

      Specified by:
      lookup in class StrLookup<V>
      Parameters:
      key - the key to be looked up, may be null
      Returns:
      the matching value, null if no match