class PropertyExtractingDelegatingItemWriter<T> extends AbstractMethodInvokingDelegator<T>
		implements ItemWriter<T> {

	private String[] fieldsUsedAsTargetMethodArguments;

	/**
	 * Extracts values from item's fields named in fieldsUsedAsTargetMethodArguments and
	 * passes them as arguments to the delegate method.
	 */
	@Override
	public void write(Chunk<? extends T> items) throws Exception {<FILL_FUNCTION_BODY>}

	@Override
	public void afterPropertiesSet() throws Exception {
		super.afterPropertiesSet();
		Assert.state(!ObjectUtils.isEmpty(fieldsUsedAsTargetMethodArguments),
				"fieldsUsedAsTargetMethodArguments must not be empty");
	}

	/**
	 * @param fieldsUsedAsMethodArguments the values of the these item's fields will be
	 * used as arguments for the delegate method. Nested property values are supported,
	 * e.g. <code>address.city</code>
	 */
	public void setFieldsUsedAsTargetMethodArguments(String[] fieldsUsedAsMethodArguments) {
		this.fieldsUsedAsTargetMethodArguments = Arrays.asList(fieldsUsedAsMethodArguments)
			.toArray(new String[fieldsUsedAsMethodArguments.length]);
	}

}

		for (T item : items) {

			// helper for extracting property values from a bean
			BeanWrapper beanWrapper = new BeanWrapperImpl(item);

			Object[] methodArguments = new Object[fieldsUsedAsTargetMethodArguments.length];
			for (int i = 0; i < fieldsUsedAsTargetMethodArguments.length; i++) {
				methodArguments[i] = beanWrapper.getPropertyValue(fieldsUsedAsTargetMethodArguments[i]);
			}

			invokeDelegateMethodWithArguments(methodArguments);

		}
	
<methods>public non-sealed void <init>() ,public void afterPropertiesSet() throws java.lang.Exception,public void setArguments(java.lang.Object[]) ,public void setTargetMethod(java.lang.String) ,public void setTargetObject(java.lang.Object) <variables>private java.lang.Object[] arguments,private java.lang.String targetMethod,private java.lang.Object targetObject