Package org.apache.commons.text.lookup
Class FileStringLookup
java.lang.Object
org.apache.commons.text.lookup.AbstractStringLookup
org.apache.commons.text.lookup.FileStringLookup
- All Implemented Interfaces:
StringLookup
Looks up keys from a file.
Using a StringLookup
from the StringLookupFactory
:
StringLookupFactory.INSTANCE.fileStringLookup().lookup(UTF-8:com/domain/document.properties");
Using a StringSubstitutor
:
StringSubstitutor.createInterpolator().replace("... ${file:UTF-8:com/domain/document.properties} ..."));
The above examples convert "UTF-8:SomePath"
to the contents of the file.
- Since:
- 1.5
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final AbstractStringLookup
Defines the singleton for this class.Fields inherited from class org.apache.commons.text.lookup.AbstractStringLookup
SPLIT_CH, SPLIT_STR
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.apache.commons.text.lookup.AbstractStringLookup
substringAfter, substringAfter, substringAfterLast, toLookupKey, toLookupKey
-
Field Details
-
INSTANCE
Defines the singleton for this class.
-
-
Constructor Details
-
FileStringLookup
private FileStringLookup()No need to build instances for now.
-
-
Method Details
-
lookup
Looks up the value for the key in the format "charsetName:DocumentPath".For example: "UTF-8:com/domain/document.properties".
- Parameters:
key
- the key to be looked up, may be null- Returns:
- The value associated with the key.
-