You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: