No announcement yet.
  • Filter
  • Time
Clear All
new posts

    Datasources and get/is

    Sorry in advance if this is obvious, but didn't manage to find it in docs.

    We have beans with booleans rather than Booleans and the getter methods for them is "is" rather than "get". can we specify that somehow. Either that boolean natives should be fetched with "is", or in the ds.xml or even field level.

    We were surprised to find that this naming pattern is actually part of the official Java Beans spec. We don't currently support it, but we'll support it in a future version.

    In the meantime, while you could add custom DMI logic to retrieve such properties, it's probably less effort to add redundant getter methods.


      Exactly, its been like that for a long time. Problem for us is that we, as many others, use Project Lombok, and they generate getters with "is" for booleans, which means we have to remember to go into all our beans and add a specific "get" method just to make smartGWT datasources work.


        Sorry to hear that Project Lombok doesn't allow configuration of how getters are generated (or that is, assuming you've actually checked..).

        There aren't other options besides the ones we've offered, except for completeness, you could sponsor the changes to ensure they land in the upcoming 6.1 final release.


          Oh, they do. Its just that their default config is "is", since it's part of the spec you mentioned, and we've had it since forever so it's in end easier to adjust for those beans that we use for smartgwt.

          Also, some beans use Spring security where all methods are "is". All together, it makes sense to keep as much as possible as it's been.


            We took a deeper look and it seems that there are some questions.

            Java Bean Specification (Chapter 8.3) allows is<PropertyName> getter for properties of boolean primitive type only. We actually do support this when reading properties from a bean. So, there should not be any problem here. Could you please explain how you ran into a case where there seemed to be a lack of support?


              Well, i noticed that if i had a Datasource with a boolean value, say "enabled", in the XML, with a spring bean as lookupstyle, i noticed that the value wasn't set unless the get method was "get" and not "is". So, since Lombok creates accessors with "is" for primitive booleans, i had to manually add a "getEnabled()"-method for smartGWT to pick up the value.


                We still cannot reproduce the issue. Both getting and setting value works on a bean with isEnabled getter and setEnabled setter. Could you please showcase the issue in a standalone test case? It would be great if you could keep it as simple as possible, for example reducing number of properties in a bean to a minimum, using local bean instead of spring etc.


                  I tried this a while back, could it be that you have fixed it since when i had the issue originally? You write in your first post that you do not support it, and back then i might have been using an older version.

                  I will go in and try it again to see if it works now. If not, i will provide a test case.


                    I tried now and i can confirm that it works even if i remove the get-method. So you can close the ticket ;)

                    I am pretty sure this was not the case in the version i used when i originally posted this last year.