Package org.springframework.batch.item.support.builder

# Class ScriptItemProcessorBuilder<I,O>

java.lang.Object
org.springframework.batch.item.support.builder.ScriptItemProcessorBuilder<I,O>

public class ScriptItemProcessorBuilder<I,O> extends Object
Creates a fully qualified ScriptItemProcessor.

Since:
  4.0
Author:
  Glenn Renfro

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ScriptItemProcessorBuilder()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ScriptItemProcessor<I,O>`
  `build()`
  Returns a fully constructed `ScriptItemProcessor`.
  `ScriptItemProcessorBuilder<I,O>`
  `itemBindingVariableName(String itemBindingVariableName)`
  Provides the ability to change the key name that scripts use to obtain the current item to process if the variable represented by: `ScriptItemProcessor.ITEM_BINDING_VARIABLE_NAME` is not suitable ("item").
  `ScriptItemProcessorBuilder<I,O>`
  `language(String language)`
  Establishes the language of the script.
  `ScriptItemProcessorBuilder<I,O>`
  `scriptResource(org.springframework.core.io.Resource resource)`
  Sets the `Resource` location of the script to use.
  `ScriptItemProcessorBuilder<I,O>`
  `scriptSource(String scriptSource)`
  Sets the provided `String` as the script source code to use.

  ### Methods inherited from class java.lang.Object

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

- ## Constructor Details

  - ### ScriptItemProcessorBuilder

    public ScriptItemProcessorBuilder()

- ## Method Details

  - ### scriptResource

    public ScriptItemProcessorBuilder<I,O> scriptResource(org.springframework.core.io.Resource resource)
    Sets the `Resource` location of the script to use. The script language will be deduced from the filename extension.
    Parameters:
      `resource` - the `Resource` location of the script to use.
    Returns:
      this instance for method chaining
    See Also:
      - `ScriptItemProcessor.setScript(Resource)`

  - ### language

    public ScriptItemProcessorBuilder<I,O> language(String language)
    Establishes the language of the script.
    Parameters:
      `language` - the language of the script.
    Returns:
      this instance for method chaining
    See Also:
      - `ScriptItemProcessor.setScriptSource(String, String)`

  - ### scriptSource

    public ScriptItemProcessorBuilder<I,O> scriptSource(String scriptSource)
    Sets the provided `String` as the script source code to use. Language must not be null nor empty when using script.
    Parameters:
      `scriptSource` - the `String` form of the script source code to use.
    Returns:
      this instance for method chaining
    See Also:
      - `ScriptItemProcessor.setScriptSource(String, String)`

  - ### itemBindingVariableName

    public ScriptItemProcessorBuilder<I,O> itemBindingVariableName(String itemBindingVariableName)
    Provides the ability to change the key name that scripts use to obtain the current item to process if the variable represented by: `ScriptItemProcessor.ITEM_BINDING_VARIABLE_NAME` is not suitable ("item").
    Parameters:
      `itemBindingVariableName` - the desired binding variable name
    Returns:
      this instance for method chaining
    See Also:
      - `ScriptItemProcessor.setItemBindingVariableName(String)`

  - ### build

    public ScriptItemProcessor<I,O> build()
    Returns a fully constructed `ScriptItemProcessor`.
    Returns:
      a new `ScriptItemProcessor`