Details
-
Type:
New Feature
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: core
-
Labels:None
-
Number of attachments :
Description
Many books on good java code practices request and require Class variable be private and be accessed only through accessor methods. The JavaBean standard defines these get/set accessor methods to be of a specific format. e.g. the variable userName would have accessor method of getUserName() and setUserName().
JiBX does have a get-method and set-method, but I'd like to streamline their use some, based upon a general Java programming standard.
The use-accessor attribute defaults to false. If set to true, the JiBX calls to set/get the value of variable will be done through the accessor methods (getXXX and setXXX) rather than direct access to the variables. If set on a structure, all elements of the structure use the get/set accessor. If set on a binding or mapping element, it defaults for all the elements within. If set true on a higher element, you can set it false on a lower element to override the setting.
I agree it's cumbersome to have to use get-method/set-method to do this now. I've thought about implementing a somewhat different approach to get to what I think is the same goal, where you use an attribute property="xxxx" to indicate you want to use accessor methods to work with a value. Do you see any problem in providing improved accessor method support this way, rather than the use-accessor attribute you requested?