davidmarquis / fluent-interface-proxy

Forget boiler plate code for your Java Fluent builders! This project provides a proxy that implements your Builder interfaces dynamically (no code required!)
MIT License
55 stars 17 forks source link

The proxy can't access protected getters and setters #1

Closed dtelaroli closed 11 years ago

dtelaroli commented 11 years ago

I propose to use setAccessible of Reflection API to permit encapsulating model properties, and no grant direct access, so, the getters and setters should be protected in anyone cases and only grant access by builder. The same for the constructors methods.

What do you think?

Ps. Congratulations for your project.

davidmarquis commented 11 years ago

Have a look at the 1.1.0 release I prepared tonight... let me know what you think!

dtelaroli commented 11 years ago

Perfect solution.

dtelaroli commented 11 years ago

David,

I think that is great add a strategy to invoke a custom constructor from javabean.

Exemple: I have a constructor with args, to final fields:

class MyBean { final String name; MyBean(String name) { this.name = name; } }

I can't use MyBean with proxy because newInstance invoke empty constructor.

Other purpose is to invoke static constructor, like the @Produces in Java CDI: static MyBean construct(String name) { return new MyBean(name); }

What do you think?

davidmarquis commented 11 years ago

Have a look at version 1.2.0 that I just pushed in (documentation on the front page has been updated with instructions)

For future improvements or ideas, I warmly invite you to submit pull requests to the project to contribute! Thanks.