Top Description Fields Constructors Methods
org.apache.commons.text.lookup

pack-priv final Class PropertiesStringLookup

extends AbstractPathFencedLookup
Class Inheritance
Imports
java.io.InputStream, java.nio.file.Files, .Path, java.util.Properties, org.apache.commons.lang3.StringUtils

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".

Public access is through StringLookupFactory.

Since
1.5
See Also
StringLookupFactory, Properties

Field Summary

Modifier and TypeField and Description
pack-priv static final PropertiesStringLookup
INSTANCE

Defines the singleton for this class.

pack-priv static final String
SEPARATOR

Separates file and key.

Inherited from org.apache.commons.text.lookup.AbstractPathFencedLookup:
fence

Constructor Summary

AccessConstructor and Description
pack-priv
PropertiesStringLookup(final Path...
The fences guarding Path resolution.
fences
)

Constructs a new instance.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

The value associated with the key.
lookup
(final String
the key to be looked up, may be null.
key
)

Implements org.apache.commons.text.lookup.StringLookup.lookup.

Looks up the value for the key in the format "DocumentPath:XPath".

pack-priv static String
toPropertyKey(final String file, final String key)

Creates a lookup key for a given file and key.

Inherited from org.apache.commons.text.lookup.AbstractPathFencedLookup:
getPath

Field Detail

INSTANCEback to summary
pack-priv static final PropertiesStringLookup INSTANCE

Defines the singleton for this class.

SEPARATORback to summary
pack-priv static final String SEPARATOR

Separates file and key.

Constructor Detail

PropertiesStringLookupback to summary
pack-priv PropertiesStringLookup(final Path... fences)

Constructs a new instance.

Parameters
fences:Path[]

The fences guarding Path resolution.

Method Detail

lookupback to summary
public String lookup(final String key)

Implements org.apache.commons.text.lookup.StringLookup.lookup.

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:String

the key to be looked up, may be null.

Returns:String

The value associated with the key.

Annotations
@Override
toPropertyKeyback to summary
pack-priv static String toPropertyKey(final String file, final String key)

Creates a lookup key for a given file and key.