Skip to content

Let FlatFileItemReader comment detection logic be customizable #1134

Closed
@spring-projects-issues

Description

@spring-projects-issues

Ville Virtanen opened BATCH-2468 and commented

We have a complex file format where there are lines that are comments and should not be read, but the format of these comments can't be determined using simple startsWith comparisons.

It would be great if the FlatFileItemReader could take a class instance in a setter that implements interface, let's say CommentDetector (and provide the current functionality by default) so that we could supply our own CommentDetector instance. The interface would be like

public interface CommentDetector {
    isComment(String line, String[] comments);
}

where the line parameter is, well the line that should be determined if it is a comment or not and comments array containing the comment line prefixes that the reader already has.

Does not affect backwards compatibility, makes it possible to implement custom detection logic without extending. (Which currently is hard/impossible because the methods that contain the detection logic are private.)


No further details from BATCH-2468

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions