JiBX
  1. JiBX
  2. JIBX-97

Add a use-accessor attribute to the property attribute group

    Details

    • Type: New Feature New Feature
    • Status: Open Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: core
    • Labels:
      None
    • Number of attachments :
      0

      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.

        Activity

        Hide
        Dennis Sosnoski added a comment -

        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?

        Show
        Dennis Sosnoski added a comment - 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?
        Hide
        Thomas Jones-Low added a comment -

        I don't. have any preference on the implementation of the use accessor flag, as long as the property cascades. The most frequent use I see would be on a structure so I don't have to go through every single element and add one (or currently two) attributes to each one.

        Show
        Thomas Jones-Low added a comment - I don't. have any preference on the implementation of the use accessor flag, as long as the property cascades. The most frequent use I see would be on a structure so I don't have to go through every single element and add one (or currently two) attributes to each one.

          People

          • Assignee:
            Dennis Sosnoski
            Reporter:
            Thomas Jones-Low
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: