Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to pass boolean value to all setters in a java bean

happybuddhaMar 16 2012 — edited Mar 16 2012
Hello,

I have a java bean as a part of a JSF application which is controlling the rendering of the view components.
With time, now we have a ton of setters and getters in the bean. So for every component to be rendered, we can either record which view the action is coming from and then set false only to that views boolean (renderer) or we just set false to all booleans and true only to the one in question.
The question really is, if my pojo has lets say 10 setter methods which will set a boolean to variables in the class. Is there a way I can pass a boolean parameter to 9 out of 10 setters (since the 10th one will be true)?
Or to all setters is also fine I can then set the one I am interested to true.

Cheers,
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 13 2012
Added on Mar 16 2012
1 comment
359 views