Friday, June 17, 2016

Re: AutoBean sample not working for me?

To clarify, you need to add something like makeAddress to DoSomething:

  Address makeAddress() {
    // Construct the AutoBean
    AutoBean<Address> address = factory.address();

    // Return the Address interface shim
    return address.as();
  }
  
Then you can change your code to:

    DoSomething test = new DoSomething();
    Person person = test.makePerson();
    person.setName("me");
    person.setAddress(test.makeAddress());
    String json = test.serializeToJson(person);

On Fri, Jun 17, 2016 at 4:13 PM, Michael McIntosh <mike.g.mcintosh@gmail.com> wrote:
You need to create the person by calling makePerson. 

Sent from my iPhone

On Jun 17, 2016, at 3:35 PM, sdfdsf dsfsdfds <bittransfer2000@gmail.com> wrote:

Hi,

I copy / pasted the AutoBean serialization example from here:


I've implemented the necessary interfaces etc to setup a quick test which can be summarized as follows:

    PersonImpl person = new PersonImpl();
    person.setName("me");
    person.setAddress(new AddressImpl(...));

    DoSomething test = new DoSomething();
  String json = test.serializeToJson(person);

The value of "json" is null. 

Is this sample working for everyone? I'm using GWT 2.7 with java 1.7.

Thanks

--
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+unsubscribe@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.

--
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+unsubscribe@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.

No comments:

Post a Comment