org.springframework.scripting.support

## 类 StandardScriptEvaluator

- java.lang.Object
- - org.springframework.scripting.support.StandardScriptEvaluator

- 所有已实现的接口:
    org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, ScriptEvaluator

      public class StandardScriptEvaluator
      extends Object
      implements ScriptEvaluator, org.springframework.beans.factory.BeanClassLoaderAware

  `javax.script` (JSR-223) based implementation of Spring's `ScriptEvaluator` strategy interface.
  从以下版本开始:
    4.0
  作者:
    Juergen Hoeller, Costin Leau
  另请参阅:
    `ScriptEngine.eval(String)`

- - ### 构造器概要

    构造器
    构造器和说明
    `StandardScriptEvaluator()` Construct a new `StandardScriptEvaluator`.
    `StandardScriptEvaluator(ClassLoader classLoader)` Construct a new `StandardScriptEvaluator` for the given class loader.
    `StandardScriptEvaluator(ScriptEngineManager scriptEngineManager)` Construct a new `StandardScriptEvaluator` for the given JSR-223 `ScriptEngineManager` to obtain script engines from.

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `Object` | `evaluate(ScriptSource script)` Evaluate the given script.
    `Object` | `evaluate(ScriptSource script, Map<String,Object> argumentBindings)` Evaluate the given script with the given arguments.
    `protected ScriptEngine` | `getScriptEngine(ScriptSource script)` Obtain the JSR-223 ScriptEngine to use for the given script.
    `void` | `setBeanClassLoader(ClassLoader classLoader)`
    `void` | `setEngineName(String engineName)` Set the name of the script engine for evaluating the scripts (e.g.
    `void` | `setGlobalBindings(Map<String,Object> globalBindings)` Set the globally scoped bindings on the underlying script engine manager, shared by all scripts, as an alternative to script argument bindings.
    `void` | `setLanguage(String language)` Set the name of the language meant for evaluating the scripts (e.g.

    - ### 从类继承的方法 java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 构造器详细资料

    - #### StandardScriptEvaluator

          public StandardScriptEvaluator()

      Construct a new `StandardScriptEvaluator`.

    - #### StandardScriptEvaluator

          public StandardScriptEvaluator(ClassLoader classLoader)

      Construct a new `StandardScriptEvaluator` for the given class loader.
      参数:
        `classLoader` - the class loader to use for script engine detection

    - #### StandardScriptEvaluator

          public StandardScriptEvaluator(ScriptEngineManager scriptEngineManager)

      Construct a new `StandardScriptEvaluator` for the given JSR-223 `ScriptEngineManager` to obtain script engines from.
      参数:
        `scriptEngineManager` - the ScriptEngineManager (or subclass thereof) to use
      从以下版本开始:
        4.2.2

  - ### 方法详细资料

    - #### setLanguage

          public void setLanguage(String language)

      Set the name of the language meant for evaluating the scripts (e.g. "Groovy").

      This is effectively an alias for `"engineName"`, potentially (but not yet) providing common abbreviations for certain languages beyond what the JSR-223 script engine factory exposes.

      另请参阅:
        `setEngineName(java.lang.String)`

    - #### setEngineName

          public void setEngineName(String engineName)

      Set the name of the script engine for evaluating the scripts (e.g. "Groovy"), as exposed by the JSR-223 script engine factory.
      从以下版本开始:
        4.2.2
      另请参阅:
        `setLanguage(java.lang.String)`

    - #### setGlobalBindings

          public void setGlobalBindings(Map<String,Object> globalBindings)

      Set the globally scoped bindings on the underlying script engine manager, shared by all scripts, as an alternative to script argument bindings.
      从以下版本开始:
        4.2.2
      另请参阅:
        `evaluate(ScriptSource, Map)`, `ScriptEngineManager.setBindings(Bindings)`, `SimpleBindings`

    - #### setBeanClassLoader

          public void setBeanClassLoader(ClassLoader classLoader)

      指定者:
        `setBeanClassLoader` 在接口中 `org.springframework.beans.factory.BeanClassLoaderAware`

    - #### evaluate

          @Nullable
          public Object evaluate(ScriptSource script)

      从接口复制的说明: `ScriptEvaluator`
      Evaluate the given script.
      指定者:
        `evaluate` 在接口中 `ScriptEvaluator`
      参数:
        `script` - the ScriptSource for the script to evaluate
      返回:
        the return value of the script, if any

    - #### evaluate

          @Nullable
          public Object evaluate(ScriptSource script,
                                            @Nullable
                                            Map<String,Object> argumentBindings)

      从接口复制的说明: `ScriptEvaluator`
      Evaluate the given script with the given arguments.
      指定者:
        `evaluate` 在接口中 `ScriptEvaluator`
      参数:
        `script` - the ScriptSource for the script to evaluate
        `argumentBindings` - the key-value pairs to expose to the script, typically as script variables (may be `null` or empty)
      返回:
        the return value of the script, if any

    - #### getScriptEngine

          protected ScriptEngine getScriptEngine(ScriptSource script)

      Obtain the JSR-223 ScriptEngine to use for the given script.
      参数:
        `script` - the script to evaluate
      返回:
        the ScriptEngine (never `null`)