Class FileStringLookup

java.lang.Object
org.apache.commons.text.lookup.AbstractStringLookup
org.apache.commons.text.lookup.FileStringLookup
All Implemented Interfaces:
StringLookup

final class FileStringLookup extends AbstractStringLookup
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 Details

  • Constructor Details

    • FileStringLookup

      private FileStringLookup()
      No need to build instances for now.
  • Method Details

    • lookup

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