Using a StringLookup from the StringLookupFactory:
StringLookupFactory.INSTANCE.fileStringLookup().lookup("UTF-8:com/domain/document.properties");
The above example converts "UTF-8:com/domain/document.properties" to the UTF-8 contents of the file at com/domain/document.properties.
Using a StringSubstitutor:
StringSubstitutor.createInterpolator().replace("... ${file:UTF-8:com/domain/document.properties} ..."));
The above example converts "UTF-8:SomePath" to the UTF-8 contents of the file at SomePath.
Public access is through StringLookupFactory.
StringLookupFactory
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final AbstractStringLookup | INSTANCE
Defines the singleton for this class. |
| Access | Constructor and Description |
|---|---|
| pack-priv | FileStringLookup(final Path...
The fences guarding Path resolution. fences)Constructs a new instance. |
| Modifier and Type | Method and Description |
|---|---|
| public String | Returns: The value associated with the key.the key to be looked up, may be null key)Implements org. Looks up the value for the key in the format "charsetName:DocumentPath". |
| INSTANCE | back to summary |
|---|---|
| pack-priv static final AbstractStringLookup INSTANCE Defines the singleton for this class. | |
| FileStringLookup | back to summary |
|---|---|
| pack-priv FileStringLookup(final Path... fences) Constructs a new instance.
| |
| lookup | back to summary |
|---|---|
| public String lookup(final String key) Implements org. Looks up the value for the key in the format "charsetName:DocumentPath". For example: "UTF-8:com/domain/document.properties". | |