Class ExceptionMapper
- java.lang.Object
-
- org.gcube.informationsystem.resourceregistry.api.exceptions.ExceptionMapper
-
public abstract class ExceptionMapper extends Object
- Author:
- Luca Frosini (ISTI - CNR)
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.gcube.com.fasterxml.jackson.databind.ObjectMappermapper
-
Constructor Summary
Constructors Constructor Description ExceptionMapper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.gcube.com.fasterxml.jackson.databind.ObjectMappergetObjectMapper()static <RRE extends ResourceRegistryException>
Stringmarshal(RRE object)Return the String serialization of a given resourcestatic <T extends OutputStream,RRE extends ResourceRegistryException>
Tmarshal(RRE object, T stream)Write the serialization of a given resource to a givenOutputStream.static <RRE extends ResourceRegistryException>
RREunmarshal(Class<RRE> clz, InputStream stream)Creates a resource of given class from its serialization in a givenInputStream.static <RRE extends ResourceRegistryException>
RREunmarshal(Class<RRE> clz, Reader reader)Creates a resource of given class from its serialization in a givenReader.static <RRE extends ResourceRegistryException>
RREunmarshal(Class<RRE> clz, String string)Creates a resource of given class from its serialization in a given String
-
-
-
Method Detail
-
getObjectMapper
public static org.gcube.com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
- Returns:
- the ObjectMapper
-
marshal
public static <T extends OutputStream,RRE extends ResourceRegistryException> T marshal(RRE object, T stream) throws org.gcube.com.fasterxml.jackson.core.JsonGenerationException, org.gcube.com.fasterxml.jackson.databind.JsonMappingException, IOException
Write the serialization of a given resource to a givenOutputStream.- Parameters:
object- the resourcestream- the stream in input- Throws:
IOExceptionorg.gcube.com.fasterxml.jackson.databind.JsonMappingExceptionorg.gcube.com.fasterxml.jackson.core.JsonGenerationException
-
marshal
public static <T extends Writer,RRE extends ResourceRegistryException> T marshal(RRE object, T writer) throws org.gcube.com.fasterxml.jackson.core.JsonGenerationException, org.gcube.com.fasterxml.jackson.databind.JsonMappingException, IOException
Write the serialization of a given resource to a givenWriter.- Parameters:
object- the resourcewriter- the writer in input- Throws:
IOExceptionorg.gcube.com.fasterxml.jackson.databind.JsonMappingExceptionorg.gcube.com.fasterxml.jackson.core.JsonGenerationException
-
marshal
public static <RRE extends ResourceRegistryException> String marshal(RRE object) throws org.gcube.com.fasterxml.jackson.core.JsonProcessingException
Return the String serialization of a given resource- Parameters:
object- the resource- Returns:
- the String serialization of a given resource
- Throws:
org.gcube.com.fasterxml.jackson.core.JsonProcessingException
-
unmarshal
public static <RRE extends ResourceRegistryException> RRE unmarshal(Class<RRE> clz, Reader reader) throws org.gcube.com.fasterxml.jackson.core.JsonParseException, org.gcube.com.fasterxml.jackson.databind.JsonMappingException, IOException
Creates a resource of given class from its serialization in a givenReader.- Parameters:
clz- the class of the resourcereader- the reader- Returns:
- the resource
- Throws:
org.gcube.com.fasterxml.jackson.core.JsonParseExceptionorg.gcube.com.fasterxml.jackson.databind.JsonMappingExceptionIOException
-
unmarshal
public static <RRE extends ResourceRegistryException> RRE unmarshal(Class<RRE> clz, InputStream stream) throws org.gcube.com.fasterxml.jackson.core.JsonParseException, org.gcube.com.fasterxml.jackson.databind.JsonMappingException, IOException
Creates a resource of given class from its serialization in a givenInputStream.- Parameters:
clz- the class of the resourcestream- the stream- Returns:
- the resource
- Throws:
IOExceptionorg.gcube.com.fasterxml.jackson.databind.JsonMappingExceptionorg.gcube.com.fasterxml.jackson.core.JsonParseException
-
unmarshal
public static <RRE extends ResourceRegistryException> RRE unmarshal(Class<RRE> clz, String string) throws org.gcube.com.fasterxml.jackson.core.JsonParseException, org.gcube.com.fasterxml.jackson.databind.JsonMappingException, IOException
Creates a resource of given class from its serialization in a given String- Parameters:
clz- the class of the resourcestring-- Returns:
- the resource
- Throws:
org.gcube.com.fasterxml.jackson.core.JsonParseExceptionorg.gcube.com.fasterxml.jackson.databind.JsonMappingExceptionIOException
-
-