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 Details

    • INSTANCE

      static final ScriptStringLookup INSTANCE
      Defines the singleton for this class.
  • Constructor Details

    • ScriptStringLookup

      private ScriptStringLookup()
      No need to build instances for now.
  • Method Details

    • lookup

      public String lookup(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.