class MultiLineTradeItemReader implements ItemReader<Trade>, ItemStream {

	private FlatFileItemReader<FieldSet> delegate;

	/**
	 * @see org.springframework.batch.item.ItemReader#read()
	 */
	@Nullable
	@Override
	public Trade read() throws Exception {<FILL_FUNCTION_BODY>}

	public void setDelegate(FlatFileItemReader<FieldSet> delegate) {
		this.delegate = delegate;
	}

	@Override
	public void close() throws ItemStreamException {
		this.delegate.close();
	}

	@Override
	public void open(ExecutionContext executionContext) throws ItemStreamException {
		this.delegate.open(executionContext);
	}

	@Override
	public void update(ExecutionContext executionContext) throws ItemStreamException {
		this.delegate.update(executionContext);
	}

}

		Trade t = null;

		for (FieldSet line; (line = this.delegate.read()) != null;) {
			String prefix = line.readString(0);
			switch (prefix) {
				case "BEGIN" -> t = new Trade(); // Record must start with 'BEGIN'
				case "INFO" -> {
					Assert.notNull(t, "No 'BEGIN' was found.");
					t.setIsin(line.readString(1));
					t.setCustomer(line.readString(2));
				}
				case "AMNT" -> {
					Assert.notNull(t, "No 'BEGIN' was found.");
					t.setQuantity(line.readInt(1));
					t.setPrice(line.readBigDecimal(2));
				}
				case "END" -> {
					return t; // Record must end with 'END'
				}
			}
		}
		Assert.isNull(t, "No 'END' was found.");
		return null;
	
<no_super_class>