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

Looking for way to validate "fluent setters" or builder pattern #122

Open
davidmichaelkarr opened this issue Jul 30, 2018 · 1 comment
Open

Comments

@davidmichaelkarr
Copy link

In many of the pojos I construct, I create "fluent setters", whose name is the property name. They call the setter, and return this. This is a simplification of the builder pattern. I want to validate these methods. I can simply use the code that I wrote a while ago before I discovered OpenPOJO, but it makes sense for this sort of thing to be done in a common framework.

I can see that the problem with validating fluent setters or the builder pattern is that there are variations of these (for instance, adding a "with" prefix). If you just assumed a static convention, it would be straightforward to do, but then it wouldn't be useful to the person who uses the variation that doesn't fit the pattern you settle on.

I'd suggest if you implemented a "FluentSetterTester", you make it parameterizable (for instance, a "prefix" parameter).

Alternatively, it might be more practical to simply publish more information about writing extensions, to facilitate my writing my own "FluentSetterTester". I've briefly looked at "SetterTester", and it looks like it might be pretty easy to write this. I guess I'll attempt this.

@gsuero
Copy link

gsuero commented May 9, 2019

Was this ever followed/implemented? I am looking into a library that can tests my POJOS with getter only and have builders in them.

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

No branches or pull requests

2 participants