Class ExceptionMapper


  • public abstract class ExceptionMapper
    extends Object
    Author:
    Luca Frosini (ISTI - CNR)
    • Field Detail

      • mapper

        protected static final org.gcube.com.fasterxml.jackson.databind.ObjectMapper mapper
    • Constructor Detail

      • ExceptionMapper

        public ExceptionMapper()
    • 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 given OutputStream .
        Parameters:
        object - the resource
        stream - the stream in input
        Throws:
        IOException
        org.gcube.com.fasterxml.jackson.databind.JsonMappingException
        org.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 given Writer .
        Parameters:
        object - the resource
        writer - the writer in input
        Throws:
        IOException
        org.gcube.com.fasterxml.jackson.databind.JsonMappingException
        org.gcube.com.fasterxml.jackson.core.JsonGenerationException
      • marshal

        public static <RRE extends ResourceRegistryExceptionString 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 given Reader.
        Parameters:
        clz - the class of the resource
        reader - the reader
        Returns:
        the resource
        Throws:
        org.gcube.com.fasterxml.jackson.core.JsonParseException
        org.gcube.com.fasterxml.jackson.databind.JsonMappingException
        IOException
      • 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 given InputStream.
        Parameters:
        clz - the class of the resource
        stream - the stream
        Returns:
        the resource
        Throws:
        IOException
        org.gcube.com.fasterxml.jackson.databind.JsonMappingException
        org.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 resource
        string -
        Returns:
        the resource
        Throws:
        org.gcube.com.fasterxml.jackson.core.JsonParseException
        org.gcube.com.fasterxml.jackson.databind.JsonMappingException
        IOException