package at.gv.egiz.eaaf.core.api.utils; import java.io.IOException; import java.io.InputStream; import com.google.gson.JsonParseException; import at.gv.egiz.eaaf.core.exceptions.EaafJsonMapperException; public interface IJsonMapper { /** * Serialize an object to a JSON string. * * @param value the object to serialize * @return a JSON string * @throws JsonProcessingException thrown when an error occurs during * serialization */ String serialize(Object value) throws EaafJsonMapperException; /** * Deserialize a JSON string. * * @param value the JSON string to deserialize * @param clazz optional parameter that determines the type of the returned * object. If not set, an {@link Object} is returned. * @param Response class type * @return the deserialized JSON string as an object of type {@code clazz} or * {@link Object} * @throws JsonParseException if the JSON string contains invalid content. * @throws JsonMappingException if the input JSON structure does not match * structure expected for result type * @throws IOException if an I/O problem occurs (e.g. unexpected * end-of-input) */ Object deserialize(String value, Class clazz) throws EaafJsonMapperException; /** * Deserialize a JSON string. * * @param is the JSON to deserialize as {@link InputStream} * @param clazz optional parameter that determines the type of the returned * object. If not set, an {@link Object} is returned. * @param Response class type * @return the deserialized JSON string as an object of type {@code clazz} or * {@link Object} * @throws JsonParseException if the JSON string contains invalid content. * @throws JsonMappingException if the input JSON structure does not match * structure expected for result type * @throws IOException if an I/O problem occurs (e.g. unexpected * end-of-input) */ Object deserialize(InputStream is, Class clazz) throws EaafJsonMapperException; }