class ScriptItemProcessorBuilder<I, O> {

	private String language;

	private Resource scriptResource;

	private String scriptSource;

	private String itemBindingVariableName;

	/**
	 * Sets the {@link org.springframework.core.io.Resource} location of the script to
	 * use. The script language will be deduced from the filename extension.
	 * @param resource the {@link org.springframework.core.io.Resource} location of the
	 * script to use.
	 * @return this instance for method chaining
	 * @see ScriptItemProcessor#setScript(Resource)
	 *
	 */
	public ScriptItemProcessorBuilder<I, O> scriptResource(Resource resource) {
		this.scriptResource = resource;

		return this;
	}

	/**
	 * Establishes the language of the script.
	 * @param language the language of the script.
	 * @return this instance for method chaining
	 * @see ScriptItemProcessor#setScriptSource(String, String)
	 */
	public ScriptItemProcessorBuilder<I, O> language(String language) {
		this.language = language;

		return this;
	}

	/**
	 * Sets the provided {@link String} as the script source code to use. Language must
	 * not be null nor empty when using script.
	 * @param scriptSource the {@link String} form of the script source code to use.
	 * @return this instance for method chaining
	 * @see ScriptItemProcessor#setScriptSource(String, String)
	 */
	public ScriptItemProcessorBuilder<I, O> scriptSource(String scriptSource) {
		this.scriptSource = scriptSource;

		return this;
	}

	/**
	 * Provides the ability to change the key name that scripts use to obtain the current
	 * item to process if the variable represented by:
	 * {@link ScriptItemProcessor#ITEM_BINDING_VARIABLE_NAME} is not suitable ("item").
	 * @param itemBindingVariableName the desired binding variable name
	 * @return this instance for method chaining
	 * @see ScriptItemProcessor#setItemBindingVariableName(String)
	 */
	public ScriptItemProcessorBuilder<I, O> itemBindingVariableName(String itemBindingVariableName) {
		this.itemBindingVariableName = itemBindingVariableName;

		return this;
	}

	/**
	 * Returns a fully constructed {@link ScriptItemProcessor}.
	 * @return a new {@link ScriptItemProcessor}
	 */
	public ScriptItemProcessor<I, O> build() {<FILL_FUNCTION_BODY>}

}

		if (this.scriptResource == null && !StringUtils.hasText(this.scriptSource)) {
			throw new IllegalArgumentException("scriptResource or scriptSource is required.");
		}

		if (StringUtils.hasText(this.scriptSource)) {
			Assert.hasText(this.language, "language is required when using scriptSource.");
		}

		ScriptItemProcessor<I, O> processor = new ScriptItemProcessor<>();
		if (StringUtils.hasText(this.itemBindingVariableName)) {
			processor.setItemBindingVariableName(this.itemBindingVariableName);
		}

		if (this.scriptResource != null) {
			processor.setScript(this.scriptResource);
		}

		if (this.scriptSource != null) {
			processor.setScriptSource(this.scriptSource, this.language);
		}

		return processor;
	
<no_super_class>