Announcement

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

    Boolean accessors convention used by SmartClient


    We are using Version: SmartClient 12.1-p20211102
    When boolean properties are accessed using accessors, it seems only "get" convention is recognised as opposed to "is" convention.
    For instance, if a boolean getter is "isFlying()" this is not serialised and I do not see flying boolean property when I look at
    serialised JavaScript object. However, after I change boolean getter to "getFlying()" it works and I can see boolean property and
    value in the JS array. We are using Version: SmartClient 12.1-p20211102

    Is SmartClient only looking for "get" convention for boolean properties as well?

    #2
    Are we talking about server-side or client-side automatic detection of APIs?

    What API are you calling where you are not seeing this alternative boolean convention followed?

    Comment


      #3
      Thanks for replying back.
      !) Client side.
      2)We are using JSTranslator.toJS

      Comment


        #4
        JSTranslator.toJS() is a server-side API, but you claim client-side, so which is it? :)

        If you are talking about server-side, and you are talking about POJO serialization, we are using standard Java CRAPI approaches - asking Java to tell us all of the POJO's properties. If that isn't returning your boolean properties that have only "is" accessors, that would be something to take up with the maintainers of the core Java language. Probably, they didn't want to also check for "is" properties because that would slow things down.

        Comment


          #5
          My bad, I am using JSTranslator.toJSVariable. What I meant was, I used JSTranslator.toJSVariable() to pass Java POJO and get JavaScript Object. However, if POJO has boolean accessors with naming convention of "is" the returned JS object doesn't have those boolean values. When I say client side, I was referring to returned JS object which to be used at client side JavaScript.

          JSTranslater.get().toJSVariable(getEmployeeById()), "EMP", out)

          For instance, above returns Employee POJO which has boolean property of "joined", and accessor as "isJoined()" then JS object EMP will not contain property "joined". However, if accessor is "getJoined()" then EMP will have "joined" with boolean value.

          Comment


            #6
            Similar issue i found for smartclientgwt in 2016 but this is fixed for Smart GWT , below is the refernce

            https://forums.smartclient.com/forum...ces-and-get-is

            Comment


              #7
              That previous thread appeared to end with no changes to the framework and people reporting everything working fine, except for one person ambiguously reporting a version-specific issue.

              Again, we are just relying on JVM API to tell us what properties your POJOs have. We didn't implement a custom Java introspection API.

              If you still think there is a framework issue here, please provide a minimal, ready-to-run test case showing the problem, and we can take a look.

              Comment

              Working...
              X