Package org.apache.commons.text.lookup
Class ScriptStringLookup
- java.lang.Object
-
- org.apache.commons.text.lookup.AbstractStringLookup
-
- org.apache.commons.text.lookup.ScriptStringLookup
-
- All Implemented Interfaces:
StringLookup
final class ScriptStringLookup extends AbstractStringLookup
Executes the script with the given engine name.Execute the script with the engine name in the format "EngineName:Script".
For example:
"javascript:3 + 4".Using a
StringSubstitutor:StringSubstitutor.createInterpolator().replace("${script:javascript:3 + 4}"));- Since:
- 1.5
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static ScriptStringLookupINSTANCEDefines the singleton for this class.-
Fields inherited from class org.apache.commons.text.lookup.AbstractStringLookup
SPLIT_CH, SPLIT_STR
-
-
Constructor Summary
Constructors Modifier Constructor Description privateScriptStringLookup()No need to build instances for now.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringlookup(java.lang.String key)Execute the script with the engine name in the format "EngineName:Script".-
Methods inherited from class org.apache.commons.text.lookup.AbstractStringLookup
substringAfter, substringAfter, substringAfterLast, toLookupKey, toLookupKey
-
-
-
-
Field Detail
-
INSTANCE
static final ScriptStringLookup INSTANCE
Defines the singleton for this class.
-
-
Method Detail
-
lookup
public java.lang.String lookup(java.lang.String key)
Execute the script with the engine name in the format "EngineName:Script". Extra colons will be ignored.For example:
"javascript:3 + 4".- Parameters:
key- the engine:script to execute, may be null- Returns:
- The value returned by the execution.
-
-