Skip to content

Prevent using both, TargetType and FieldSetMapper, during compilation #4888

Open
@patbaumgartner

Description

@patbaumgartner

Having a custom DSL (builder) for FlatFileItemReaderBuilder to prevent using targetType() and fieldSetMapper() at the same time. This should provide compile-time feedback for this breaking change.

To make things more consistent, one should also adjust the JdbcBatchItemWriterBuilder. This would affect collumnMapped() and beanMapped().

Expected Behavior

The following code snippet should not compile.

new FlatFileItemReaderBuilder<Foo>().name("fooReader")
			.resource(getResource("1;2;3"))
			.lineTokenizer(line -> new DefaultFieldSet(line.split(";")))
			.targetType(Foo.class)
			.fieldSetMapper(fieldSet -> new Foo());

Current Behavior

Currently, an IllegalStateException is thrown at runtime.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions