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

Remove non-idiomatic ShapeVisitor builder #413

Merged
merged 1 commit into from
May 4, 2020
Merged

Conversation

mtdowling
Copy link
Member

We previously had a builder that could create a ShapeVisitor from a
bunch of closures. This is actually not very idiomatic Java when
compared to just implementing an anonymous class that implements
ShapeVisitor.Default.

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

We previously had a builder that could create a ShapeVisitor from a
bunch of closures. This is actually not very idiomatic Java when
compared to just implementing an anonymous class that implements
ShapeVisitor.Default.
@mtdowling mtdowling requested a review from kstich May 3, 2020 03:19
ShapeVisitor<List<ValidationEvent>> visitor = new ShapeVisitor.Default<List<ValidationEvent>>() {
@Override
protected List<ValidationEvent> getDefault(Shape shape) {
if (shape.isStringShape() || shape instanceof NumberShape) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The expansion on this to be NumberShape means a few more shape types will be validated: byte, double, and the Big* numbers. Seems like that would be intended but calling out in case.

@mtdowling mtdowling merged commit 41d93b6 into 1.0 May 4, 2020
@mtdowling mtdowling deleted the remove-dynamic-visitor branch May 4, 2020 20:07
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.

2 participants