As seen in the JsInterop document such public properties will default to 
whatever the native JS object defaults to after construction.


// JS library

com.acme.Foo = function() {
  // defaults
  this.x = 40; 
  this.y = 2;
};

com.acme.Foo.prototype.sum = function() { return this.x + this.y; };


// Java

@JsType(isNative = true)
class Foo {
  public int x; // defaults to 40
  public int y; // defaults to 2

  public native int sum();
}


class FooMain {

  public static void main() {
    Foo foo = new Foo();
    foo.sum(); // will return 42!
    foo.x = 50;
    foo.y = 5;
    foo.sum(); // will return 55! 
  }
}


-- J.

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to