Package org.apache.commons.text.lookup
Class PropertiesStringLookup
- java.lang.Object
-
- org.apache.commons.text.lookup.AbstractStringLookup
-
- org.apache.commons.text.lookup.PropertiesStringLookup
-
- All Implemented Interfaces:
StringLookup
final class PropertiesStringLookup extends AbstractStringLookup
Looks up keys from a properties file.Looks up the value for a given key in the format "Document::Key".
Note the use of "::" instead of ":" to allow for "C:" drive letters in paths.
For example: "com/domain/document.properties:key".
- Since:
- 1.5
- See Also:
Properties
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static PropertiesStringLookup
INSTANCE
Defines the singleton for this class.(package private) static java.lang.String
SEPARATOR
Separates file and key.-
Fields inherited from class org.apache.commons.text.lookup.AbstractStringLookup
SPLIT_CH, SPLIT_STR
-
-
Constructor Summary
Constructors Modifier Constructor Description private
PropertiesStringLookup()
No need to build instances for now.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
lookup(java.lang.String key)
Looks up the value for the key in the format "DocumentPath:XPath".(package private) static java.lang.String
toPropertyKey(java.lang.String file, java.lang.String key)
Creates a lookup key for a given file and key.-
Methods inherited from class org.apache.commons.text.lookup.AbstractStringLookup
substringAfter, substringAfter, substringAfterLast, toLookupKey, toLookupKey
-
-
-
-
Field Detail
-
INSTANCE
static final PropertiesStringLookup INSTANCE
Defines the singleton for this class.
-
SEPARATOR
static final java.lang.String SEPARATOR
Separates file and key.- See Also:
- Constant Field Values
-
-
Method Detail
-
toPropertyKey
static java.lang.String toPropertyKey(java.lang.String file, java.lang.String key)
Creates a lookup key for a given file and key.
-
lookup
public java.lang.String lookup(java.lang.String key)
Looks up the value for the key in the format "DocumentPath:XPath".For example: "com/domain/document.xml::/path/to/node".
Note the use of "::" instead of ":" to allow for "C:" drive letters in paths.
- Parameters:
key
- the key to be looked up, may be null- Returns:
- The value associated with the key.
-
-