javastrava.json.JsonUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of javastrava-api Show documentation
Show all versions of javastrava-api Show documentation
Java implementation of the Strava API
package javastrava.json;
import java.io.InputStream;
import javastrava.json.exception.JsonSerialisationException;
/**
*
* Abstracted JSON utilities for serialisation and de-serialisation, so we're not reliant on any one JSON library for the basic code
*
*
* @author Dan Shannon
*/
public interface JsonUtil {
/**
* Deserialise an input stream representation of a JSON document to the named class
*
* @param is The input stream to deserialise
* @param class1 The class to which is should be deserialised
* @param Class to deserialise to
* @return An instance of the class as deserialised from the document
* @throws JsonSerialisationException If something goes horribly wrong in deserialisation
*/
public abstract T deserialise(final InputStream is, final Class class1) throws JsonSerialisationException;
/**
* Deserialise a string representation of a JSON document to the named class
* @param input The input string to deserialise
* @param class1 The class to which the input should be deserialised
* @param Class to deserialise to
* @return An instance of the class as deserialised from the document
* @throws JsonSerialisationException If something goes horribly wrong in deserialisation
*/
public abstract T deserialise(final String input, final Class class1) throws JsonSerialisationException;
/**
* Serialise an object to a JSON string
* @param object The object to be serialised
* @param Class to serialise
* @return The JSON string representation of the object
* @throws JsonSerialisationException If something goes horribly wrong in serialisation
*/
public abstract String serialise(final T object) throws JsonSerialisationException;
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy