Class 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
    • Constructor Detail

      • FileStringLookup

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

      • lookup

        public java.lang.String lookup​(java.lang.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.