Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unnecessary generic type in BeanValidationRecordValidator #204

Closed
fmbenhassine opened this issue Sep 6, 2016 · 0 comments
Closed

Unnecessary generic type in BeanValidationRecordValidator #204

fmbenhassine opened this issue Sep 6, 2016 · 0 comments
Assignees
Labels
Milestone

Comments

@fmbenhassine
Copy link
Member

fmbenhassine commented Sep 6, 2016

The following example shows incoherence in API design:

Job job = new JobBuilder()
    .reader(new FlatFileRecordReader("tweets.csv"))
    .mapper(new DelimitedRecordMapper(Tweet.class, "id", "name", "message"))
    .validator(new BeanValidationRecordValidator<Tweet>())
    .marshaller(new XmlRecordMarshaller(Tweet.class))
    .build();

The DelimitedRecordMapper and XmlRecordMarshaller take the target type as parameter, while the BeanValidationRecordValidator is generic and is parametrized with the target type.

Looking at the implementation of BeanValidationRecordValidator, ConstraintViolation is the root origin of genericity needs, but methods called on it does not use the generic type. Hence, the generic type can be removed form BeanValidationRecordValidator.

@fmbenhassine fmbenhassine added this to the 4.2.0 milestone Sep 6, 2016
@fmbenhassine fmbenhassine changed the title BeanValidationRecordValidator should take the validated type as parameter Unnecessary generic type for BeanValidationRecordValidator Sep 8, 2016
fmbenhassine added a commit that referenced this issue Sep 24, 2016
…atible, will be planned for v5 if necessary)
@fmbenhassine fmbenhassine removed this from the 4.2.0 milestone Sep 24, 2016
@fmbenhassine fmbenhassine added this to the 5.0.0 milestone Sep 27, 2016
@fmbenhassine fmbenhassine self-assigned this Sep 27, 2016
@fmbenhassine fmbenhassine changed the title Unnecessary generic type for BeanValidationRecordValidator Unnecessary generic type in BeanValidationRecordValidator Sep 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant