com.github.nmorel.gwtjackson.client.ObjectReader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gwt-jackson Show documentation
Show all versions of gwt-jackson Show documentation
gwt-jackson is a GWT JSON serializer/deserializer mechanism based on Jackson annotations
package com.github.nmorel.gwtjackson.client;
import com.github.nmorel.gwtjackson.client.exception.JsonDeserializationException;
import com.google.gwt.core.client.GWT;
/**
* Reads a JSON input and return an object
* To generate an implementation, use {@link GWT#create(Class)}.
* Example :
*
* public class Person {
* public String firstName, lastName;
* }
*
* public interface PersonReader extends ObjectReader<Person> {}
*
* PersonReader reader = GWT.create(PersonReader.class);
* Person person = reader.read("{\"firstName\":\"Nicolas\",\"lastName\":\"Morel\"}");
*
* person.firstName ==> "Nicolas"
* person.lastName ==> "Morel"
*
*
* @param Type of the read object
*
* @author Nicolas Morel
*/
public interface ObjectReader {
/**
* Reads a JSON input into an object.
*
* @param input JSON input to read
*
* @return the read object
* @throws JsonDeserializationException if an exception occurs while reading the input
*/
T read( String input ) throws JsonDeserializationException;
/**
* Reads a JSON input into an object.
*
* @param input JSON input to read
* @param ctx Context for the full reading process
*
* @return the read object
* @throws JsonDeserializationException if an exception occurs while reading the input
*/
T read( String input, JsonDeserializationContext ctx ) throws JsonDeserializationException;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy