public final class StringLookupFactory extends Object
The default lookups are:
Modifier and Type | Field and Description |
---|---|
static StringLookupFactory |
INSTANCE
Defines the singleton for this class.
|
static String |
KEY_BASE64_DECODER
Default lookup key for interpolation.
|
static String |
KEY_BASE64_ENCODER
Default lookup key for interpolation.
|
static String |
KEY_CONST
Default lookup key for interpolation.
|
static String |
KEY_DATE
Default lookup key for interpolation.
|
static String |
KEY_ENV
Default lookup key for interpolation.
|
static String |
KEY_FILE
Default lookup key for interpolation.
|
static String |
KEY_JAVA
Default lookup key for interpolation.
|
static String |
KEY_LOCALHOST
Default lookup key for interpolation.
|
static String |
KEY_PROPERTIES
Default lookup key for interpolation.
|
static String |
KEY_RESOURCE_BUNDLE
Default lookup key for interpolation.
|
static String |
KEY_SCRIPT
Default lookup key for interpolation.
|
static String |
KEY_SYS
Default lookup key for interpolation.
|
static String |
KEY_URL
Default lookup key for interpolation.
|
static String |
KEY_URL_DECODER
Default lookup key for interpolation.
|
static String |
KEY_URL_ENCODER
Default lookup key for interpolation.
|
static String |
KEY_XML
Default lookup key for interpolation.
|
Modifier and Type | Method and Description |
---|---|
void |
addDefaultStringLookups(Map<String,StringLookup> stringLookupMap)
Adds the
default lookups . |
StringLookup |
base64DecoderStringLookup()
Returns the Base64DecoderStringLookup singleton instance to format the current date with the format given in the
key in a format compatible with
SimpleDateFormat . |
StringLookup |
base64EncoderStringLookup()
Returns the Base64EncoderStringLookup singleton instance to format the current date with the format given in the
key in a format compatible with
SimpleDateFormat . |
StringLookup |
base64StringLookup()
Deprecated.
|
static void |
clear()
Clears any static resources.
|
StringLookup |
constantStringLookup()
Returns the ConstantStringLookup singleton instance to get the value of a fully-qualified static final value.
|
StringLookup |
dateStringLookup()
Returns the DateStringLookup singleton instance to format the current date with the format given in the key in a
format compatible with
SimpleDateFormat . |
StringLookup |
environmentVariableStringLookup()
Returns the EnvironmentVariableStringLookup singleton instance where the lookup key is an environment variable
name.
|
StringLookup |
fileStringLookup()
Returns the FileStringLookup singleton instance.
|
StringLookup |
interpolatorStringLookup()
Returns a new InterpolatorStringLookup using the
default lookups . |
StringLookup |
interpolatorStringLookup(Map<String,StringLookup> stringLookupMap,
StringLookup defaultStringLookup,
boolean addDefaultLookups)
Returns a new InterpolatorStringLookup using the
default lookups . |
<V> StringLookup |
interpolatorStringLookup(Map<String,V> map)
Returns a new InterpolatorStringLookup using the
default lookups . |
StringLookup |
interpolatorStringLookup(StringLookup defaultStringLookup)
Returns a new InterpolatorStringLookup using the
default lookups . |
StringLookup |
javaPlatformStringLookup()
Returns the JavaPlatformStringLookup singleton instance.
|
StringLookup |
localHostStringLookup()
Returns the LocalHostStringLookup singleton instance where the lookup key is one of:
name: for the local host name, for example
EXAMPLE .
canonical-name: for the local canonical host name, for example EXAMPLE.apache.org .
address: for the local host address, for example 192.168.56.1 .
|
<V> StringLookup |
mapStringLookup(Map<String,V> map)
Returns a new map-based lookup where the request for a lookup is answered with the value for that key.
|
StringLookup |
nullStringLookup()
Returns the NullStringLookup singleton instance which always returns null.
|
StringLookup |
propertiesStringLookup()
Returns the PropertiesStringLookup singleton instance.
|
StringLookup |
resourceBundleStringLookup()
Returns the ResourceBundleStringLookup singleton instance.
|
StringLookup |
resourceBundleStringLookup(String bundleName)
Returns a ResourceBundleStringLookup instance for the given bundle name.
|
StringLookup |
scriptStringLookup()
Returns the ScriptStringLookup singleton instance.
|
StringLookup |
systemPropertyStringLookup()
Returns the SystemPropertyStringLookup singleton instance where the lookup key is a system property name.
|
StringLookup |
urlDecoderStringLookup()
Returns the UrlDecoderStringLookup singleton instance.
|
StringLookup |
urlEncoderStringLookup()
Returns the UrlDecoderStringLookup singleton instance.
|
StringLookup |
urlStringLookup()
Returns the UrlStringLookup singleton instance.
|
StringLookup |
xmlStringLookup()
Returns the XmlStringLookup singleton instance.
|
public static final StringLookupFactory INSTANCE
public static final String KEY_BASE64_DECODER
public static final String KEY_BASE64_ENCODER
public static final String KEY_CONST
public static final String KEY_DATE
public static final String KEY_ENV
public static final String KEY_FILE
public static final String KEY_JAVA
public static final String KEY_LOCALHOST
public static final String KEY_PROPERTIES
public static final String KEY_RESOURCE_BUNDLE
public static final String KEY_SCRIPT
public static final String KEY_SYS
public static final String KEY_URL
public static final String KEY_URL_DECODER
public static final String KEY_URL_ENCODER
public static final String KEY_XML
public static void clear()
public void addDefaultStringLookups(Map<String,StringLookup> stringLookupMap)
default lookups
.stringLookupMap
- the map of string lookups.public StringLookup base64DecoderStringLookup()
SimpleDateFormat
.public StringLookup base64EncoderStringLookup()
SimpleDateFormat
.@Deprecated public StringLookup base64StringLookup()
base64DecoderStringLookup()
.SimpleDateFormat
.public StringLookup constantStringLookup()
public StringLookup dateStringLookup()
SimpleDateFormat
.public StringLookup environmentVariableStringLookup()
public StringLookup fileStringLookup()
Looks up the value for the key in the format "CharsetName:Path".
For example: "UTF-8:com/domain/document.properties".
public StringLookup interpolatorStringLookup()
default lookups
.public StringLookup interpolatorStringLookup(Map<String,StringLookup> stringLookupMap, StringLookup defaultStringLookup, boolean addDefaultLookups)
default lookups
.
If addDefaultLookups
is true, the following lookups are used in addition to the ones provided in
stringLookupMap
:
stringLookupMap
- the map of string lookups.defaultStringLookup
- the default string lookup.addDefaultLookups
- whether to use lookups as described above.public <V> StringLookup interpolatorStringLookup(Map<String,V> map)
default lookups
.V
- the value type the default string lookup's map.map
- the default map for string lookups.public StringLookup interpolatorStringLookup(StringLookup defaultStringLookup)
default lookups
.defaultStringLookup
- the default string lookup.public StringLookup javaPlatformStringLookup()
The lookup keys with examples are:
public StringLookup localHostStringLookup()
EXAMPLE
.EXAMPLE.apache.org
.192.168.56.1
.public <V> StringLookup mapStringLookup(Map<String,V> map)
V
- the map value type.map
- the map.public StringLookup nullStringLookup()
public StringLookup propertiesStringLookup()
Looks up the value for the key in the format "DocumentPath:Key".
For example: "com/domain/document.properties:Key".
public StringLookup resourceBundleStringLookup()
Looks up the value for a given key in the format "BundleName:BundleKey".
For example: "com.domain.messages:MyKey".
public StringLookup resourceBundleStringLookup(String bundleName)
Looks up the value for a given key in the format "BundleKey".
For example: "MyKey".
bundleName
- Only lookup in this bundle.public StringLookup scriptStringLookup()
Looks up the value for the key in the format "ScriptEngineName:Script".
For example: "javascript:\"HelloWorld\"".
public StringLookup systemPropertyStringLookup()
public StringLookup urlDecoderStringLookup()
Decodes URL Strings using the UTF-8 encoding.
For example: "Hello%20World%21" becomes "Hello World!".
public StringLookup urlEncoderStringLookup()
Decodes URL Strings using the UTF-8 encoding.
For example: "Hello World!" becomes "Hello+World%21".
public StringLookup urlStringLookup()
Looks up the value for the key in the format "CharsetName:URL".
For example, using the HTTP scheme: "UTF-8:http://www.google.com"
For example, using the file scheme: "UTF-8:file:///C:/somehome/commons/commons-text/src/test/resources/document.properties"
public StringLookup xmlStringLookup()
Looks up the value for the key in the format "DocumentPath:XPath".
For example: "com/domain/document.xml:/path/to/node".
Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.