Class 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 Detail

      • INSTANCE

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

      • ScriptStringLookup

        private ScriptStringLookup()
        No need to build instances for now.
    • 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.