Class SEMapper

java.lang.Object
org.gcube.vremanagement.executor.json.SEMapper

public class SEMapper extends Object
Author:
Luca Frosini (ISTI - CNR)
  • Field Details

    • mapper

      protected final org.gcube.com.fasterxml.jackson.databind.ObjectMapper mapper
    • CLASS_PROPERTY

      public static final String CLASS_PROPERTY
      See Also:
    • instance

      protected static SEMapper instance
  • Method Details

    • getInstance

      public static SEMapper getInstance()
    • registerSubtypes

      public void registerSubtypes(Class<?> classes)
    • marshal

      public <T extends OutputStream, O> T marshal(O 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 <T extends Writer, O> T marshal(O 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 <O> String marshal(O object) throws org.gcube.com.fasterxml.jackson.core.JsonProcessingException
      Return the String serialization of a given object
      Parameters:
      object - the object to marshal
      Returns:
      the String serialization of a given resource
      Throws:
      org.gcube.com.fasterxml.jackson.core.JsonProcessingException
    • marshal

      public <O> String marshal(Class<O> clz, List<O> list) throws org.gcube.com.fasterxml.jackson.core.JsonProcessingException
      Return the String serialization of a given list
      Parameters:
      list - the list to marshal
      Returns:
      the String serialization of a given list
      Throws:
      org.gcube.com.fasterxml.jackson.core.JsonProcessingException
    • marshal

      public <O> String marshal(O[] array) throws org.gcube.com.fasterxml.jackson.core.JsonProcessingException
      Return the String serialization of a given array
      Parameters:
      array - the array to marshal
      Returns:
      the String serialization of a given array
      Throws:
      org.gcube.com.fasterxml.jackson.core.JsonProcessingException
    • unmarshal

      public <O> O unmarshal(Class<O> 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 <O> O unmarshal(Class<O> 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 <O> O unmarshal(Class<O> 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
    • unmarshalList

      public <O> List<O> unmarshalList(Class<O> clz, String string) throws org.gcube.com.fasterxml.jackson.core.JsonParseException, org.gcube.com.fasterxml.jackson.databind.JsonMappingException, IOException
      Throws:
      org.gcube.com.fasterxml.jackson.core.JsonParseException
      org.gcube.com.fasterxml.jackson.databind.JsonMappingException
      IOException
    • unmarshalList

      public <O> List<O> unmarshalList(String string) throws org.gcube.com.fasterxml.jackson.core.JsonParseException, org.gcube.com.fasterxml.jackson.databind.JsonMappingException, IOException
      Throws:
      org.gcube.com.fasterxml.jackson.core.JsonParseException
      org.gcube.com.fasterxml.jackson.databind.JsonMappingException
      IOException