Skip to content

Conversation

DevSeongmin
Copy link

Description
When using FlatFileItemWriterBuilder with Java Record types, specifying .names() is currently required, but RecordFieldExtractor ignores those names due to a missing .setNames() call. This causes all record components to be extracted regardless of the .names() setting, leading to unexpected behavior.

This patch fixes the issue by invoking .setNames() on RecordFieldExtractor when names are specified, aligning its behavior with BeanWrapperFieldExtractor used for non-record types.

No breaking changes are introduced.

Changes
Added .setNames() call on newly created RecordFieldExtractor if names are provided.

Maintains consistency and backward compatibility in builder API.

Motivation
Enables partial field extraction from Java Records via .names() method, matching the behavior for Java Beans.

Resolves a long-standing inconsistency and confusion reported by users and educators.

Additional Notes
Powerd by KILL-9 💀

Related Issue
This PR addresses issue #4935

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant