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
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
FieldsModifier and TypeFieldDescription(package private) static final ScriptStringLookup
Defines the singleton for this class.Fields inherited from class org.apache.commons.text.lookup.AbstractStringLookup
SPLIT_CH, SPLIT_STR
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.apache.commons.text.lookup.AbstractStringLookup
substringAfter, substringAfter, substringAfterLast, toLookupKey, toLookupKey
-
Field Details
-
INSTANCE
Defines the singleton for this class.
-
-
Constructor Details
-
ScriptStringLookup
private ScriptStringLookup()No need to build instances for now.
-
-
Method Details
-
lookup
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.
-