class ScriptItemProcessor<I, O> implements ItemProcessor<I, O>, InitializingBean {

	public static final String ITEM_BINDING_VARIABLE_NAME = "item";

	private String language;

	private ScriptSource script;

	private ScriptSource scriptSource;

	private ScriptEvaluator scriptEvaluator;

	private String itemBindingVariableName = ITEM_BINDING_VARIABLE_NAME;

	@Nullable
	@Override
	@SuppressWarnings("unchecked")
	public O process(I item) throws Exception {<FILL_FUNCTION_BODY>}

	/**
	 * <p>
	 * Sets the {@link org.springframework.core.io.Resource} location of the script to
	 * use. The script language will be deduced from the filename extension.
	 * </p>
	 * @param resource the {@link org.springframework.core.io.Resource} location of the
	 * script to use.
	 */
	public void setScript(Resource resource) {
		Assert.notNull(resource, "The script resource cannot be null");

		this.script = new ResourceScriptSource(resource);
	}

	/**
	 * <p>
	 * Sets the provided {@link String} as the script source code to use.
	 * </p>
	 * @param scriptSource the {@link String} form of the script source code to use.
	 * @param language the language of the script.
	 */
	public void setScriptSource(String scriptSource, String language) {
		Assert.hasText(language, "Language must contain the script language");
		Assert.hasText(scriptSource, "Script source must contain the script source to evaluate");

		this.language = language;
		this.scriptSource = new StaticScriptSource(scriptSource);
	}

	/**
	 * <p>
	 * Provides the ability to change the key name that scripts use to obtain the current
	 * item to process if the variable represented by:
	 * {@link org.springframework.batch.item.support.ScriptItemProcessor#ITEM_BINDING_VARIABLE_NAME}
	 * is not suitable ("item").
	 * </p>
	 * @param itemBindingVariableName the desired binding variable name
	 */
	public void setItemBindingVariableName(String itemBindingVariableName) {
		this.itemBindingVariableName = itemBindingVariableName;
	}

	/**
	 * <p>
	 * Provides the ability to set a custom
	 * {@link org.springframework.scripting.ScriptEvaluator} implementation. If not set, a
	 * {@link org.springframework.scripting.support.StandardScriptEvaluator} will be used
	 * by default.
	 * </p>
	 * @param scriptEvaluator the {@link org.springframework.scripting.ScriptEvaluator} to
	 * use
	 */
	public void setScriptEvaluator(ScriptEvaluator scriptEvaluator) {
		this.scriptEvaluator = scriptEvaluator;
	}

	@Override
	public void afterPropertiesSet() throws Exception {
		if (scriptEvaluator == null) {
			scriptEvaluator = new StandardScriptEvaluator();
		}

		Assert.state(scriptSource != null || script != null,
				"Either the script source or script file must be provided");

		Assert.state(scriptSource == null || script == null,
				"Either a script source or script file must be provided, not both");

		if (scriptSource != null && scriptEvaluator instanceof StandardScriptEvaluator) {
			Assert.state(StringUtils.hasLength(language),
					"Language must be provided when using the default ScriptEvaluator and raw source code");

			((StandardScriptEvaluator) scriptEvaluator).setLanguage(language);
		}
	}

	private ScriptSource getScriptSource() {
		if (script != null) {
			return script;
		}

		if (scriptSource != null) {
			return scriptSource;
		}

		throw new IllegalStateException("Either a script source or script needs to be provided.");
	}

}

		Map<String, Object> arguments = new HashMap<>();
		arguments.put(itemBindingVariableName, item);

		return (O) scriptEvaluator.evaluate(getScriptSource(), arguments);
	
<no_super_class>