Package org.apache.commons.text
Class StrLookup.MapStrLookup<V>
java.lang.Object
org.apache.commons.text.StrLookup<V>
org.apache.commons.text.StrLookup.MapStrLookup<V>
- Type Parameters:
V- the type of the values supported by the lookup
- All Implemented Interfaces:
Function<String,,String> UnaryOperator<String>,StringLookup
Lookup implementation that uses a Map.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateMapStrLookup(Map<String, V> map) Creates a new instance backed by a Map. -
Method Summary
Methods inherited from class org.apache.commons.text.StrLookup
mapLookup, noneLookup, resourceBundleLookup, systemPropertiesLookupMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.commons.text.lookup.StringLookup
apply
-
Field Details
-
map
Map keys are variable names and value.
-
-
Constructor Details
-
MapStrLookup
Creates a new instance backed by a Map.- Parameters:
map- the map of keys to values, may be null
-
-
Method Details
-
lookup
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
-