Package org.apache.commons.text.lookup
Class StringLookupFactory.DefaultStringLookupsHolder
java.lang.Object
org.apache.commons.text.lookup.StringLookupFactory.DefaultStringLookupsHolder
- Enclosing class:
StringLookupFactory
Internal class used to construct the default
StringLookup map used by
StringLookupFactory.addDefaultStringLookups(Map).-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<String, StringLookup> Default string lookup map.(package private) static final StringLookupFactory.DefaultStringLookupsHolderSingleton instance, initialized with the system properties. -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new instance initialized with the given properties. -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidaddLookup(DefaultStringLookup lookup, Map<String, StringLookup> map) Add the key and string lookup fromlookuptomap, also adding any additional key aliases if needed.private static Map<String, StringLookup> Create the lookup map used when the user has requested no customization.(package private) Map<String, StringLookup> Get the default string lookups map.private static Map<String, StringLookup> parseStringLookups(String str) Construct a lookup map by parsing the given string.
-
Field Details
-
INSTANCE
Singleton instance, initialized with the system properties. -
defaultStringLookups
Default string lookup map.
-
-
Constructor Details
-
DefaultStringLookupsHolder
DefaultStringLookupsHolder(Properties props) Construct a new instance initialized with the given properties.- Parameters:
props- initialization properties
-
-
Method Details
-
addLookup
Add the key and string lookup fromlookuptomap, also adding any additional key aliases if needed. Keys are normalized using theStringLookupFactory.toKey(String)method.- Parameters:
lookup- lookup to addmap- map to add to
-
createDefaultStringLookups
Create the lookup map used when the user has requested no customization.- Returns:
- default lookup map
-
parseStringLookups
Construct a lookup map by parsing the given string. The string is expected to contain comma or space-separated names of values from theDefaultStringLookupenum. If the given string is null or empty, an empty map is returned.- Parameters:
str- string to parse; may be null or empty- Returns:
- lookup map parsed from the given string
-
getDefaultStringLookups
Map<String,StringLookup> getDefaultStringLookups()Get the default string lookups map.- Returns:
- default string lookups map
-