T - Type of the object to writepublic interface ObjectWriter<T>
To generate an implementation, use GWT.create(Class).
Example :
public class Person {
public String firstName, lastName;
public Person(String firstName, String lastName){
this.firstName = firstName;
this.lastName = lastName;
}
}
public interface PersonWriter extends ObjectWriter<Person> {}
PersonWriter writer = GWT.create(PersonWriter.class);
String json = writer.write(new Person("Nicolas", "Morel"));
json ==> {"firstName":"Nicolas","lastName":"Morel"}
String write(T value) throws JsonSerializationException
value - Object to writeJsonSerializationException - if an exception occurs while writing the outputString write(T value, JsonSerializationContext ctx) throws JsonSerializationException
value - Object to writectx - Context for the full writing processJsonSerializationException - if an exception occurs while writing the outputCopyright © 2016. All Rights Reserved.