Class BshScriptEvaluator

java.lang.Object
org.springframework.scripting.bsh.BshScriptEvaluator
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, ScriptEvaluator

public class BshScriptEvaluator extends Object implements ScriptEvaluator, org.springframework.beans.factory.BeanClassLoaderAware
BeanShell-based implementation of Spring's ScriptEvaluator strategy interface.
Since:
4.0
Author:
Juergen Hoeller
See Also:
  • Interpreter.eval(String)
  • Constructor Details

    • BshScriptEvaluator

      public BshScriptEvaluator()
      Construct a new BshScriptEvaluator.
    • BshScriptEvaluator

      public BshScriptEvaluator(ClassLoader classLoader)
      Construct a new BshScriptEvaluator.
      Parameters:
      classLoader - the ClassLoader to use for the Interpreter
  • Method Details

    • setBeanClassLoader

      public void setBeanClassLoader(ClassLoader classLoader)
      Specified by:
      setBeanClassLoader in interface org.springframework.beans.factory.BeanClassLoaderAware
    • evaluate

      @Nullable public Object evaluate(ScriptSource script)
      Description copied from interface: ScriptEvaluator
      Evaluate the given script.
      Specified by:
      evaluate in interface ScriptEvaluator
      Parameters:
      script - the ScriptSource for the script to evaluate
      Returns:
      the return value of the script, if any
    • evaluate

      @Nullable public Object evaluate(ScriptSource script, @Nullable Map<String,Object> arguments)
      Description copied from interface: ScriptEvaluator
      Evaluate the given script with the given arguments.
      Specified by:
      evaluate in interface ScriptEvaluator
      Parameters:
      script - the ScriptSource for the script to evaluate
      arguments - the key-value pairs to expose to the script, typically as script variables (may be null or empty)
      Returns:
      the return value of the script, if any