/** * Map the {@link org.springframework.batch.item.file.transform.FieldSet} to an object retrieved from the enclosing Spring * context, or to a new instance of the required type if no prototype is * available. * * @throws org.springframework.validation.BindException if there is a type conversion or other error (if * the {@link org.springframework.validation.DataBinder} from {@link #createBinder(Object)} has errors * after binding). * @throws org.springframework.beans.NotWritablePropertyException if the {@link org.springframework.batch.item.file.transform.FieldSet} contains a * field that cannot be mapped to a bean property. * @see org.springframework.batch.item.file.mapping.FieldSetMapper#mapFieldSet(org.springframework.batch.item.file.transform.FieldSet) */ @Override public T mapRow(RowSet rs) throws BindException { T copy = getBean(); DataBinder binder = createBinder(copy); binder.bind(new MutablePropertyValues(getBeanProperties(copy, rs.getProperties()))); if (binder.getBindingResult().hasErrors()) { throw new BindException(binder.getBindingResult()); } return copy; }