Announcement

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

    Usage question: Java Longs on the clientside needed?

    Hello Isomorphic,

    I noticed that the signatures for FormItem setters are very different, e.g.
    • void setValue(boolean value)
    • void setValue(double value)
    • void setValue(int value)
    • void setValue(java.lang.Object value)
    • void setValue(java.lang.String value)
    • void setValue(java.util.Date value)
    • void setDefaultValue(java.lang.Boolean defaultValue)
    • void setDefaultValue(java.lang.Double defaultValue)
    • void setDefaultValue(java.lang.Float defaultValue)
    • void setDefaultValue(java.lang.Integer defaultValue)
    • void setDefaultValue(java.lang.Object value)
    • void setDefaultValue(java.lang.String defaultValue)
    • void setDefaultValue(java.util.Date defaultValue)


    Also, there is no Long. If I try to set a Long, the Object-signature will be used. Is this correct and supposed that way?
    I'm pretty sure it is, I just want to be safe from any surprises.

    Are there any guidelines for the clientside and serverside?
    Will the Java and compiled JavaScript Integer always be able to cover the range from –2,147,483,648 to 2,147,483,647? In that case, I would not need Long.

    Thank you & Best regards,
    Blama

    #2
    You should not need to use Longs to represent the range your describing. In JS, all numbers are just represented as "Number", and the client-side Java compilation will convert from Float / Int etc to that format.

    To quote the ECMA spec:
    ...Note that all the positive and negative integers whose magnitude is no greater than 2^53 are representable in the Number type (indeed, the integer 0 has two representations, +0 and −0).
    This means you should not lose precision until you hit 2^53, or +/- 9007199254740992

    Hope this helps

    Isomorphic Software

    Comment

    Working...
    X