Class SEMapper
java.lang.Object
org.gcube.vremanagement.executor.json.SEMapper
- Author:
- Luca Frosini (ISTI - CNR)
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic SEMapper<O> StringReturn the String serialization of a given list<O> Stringmarshal(O object) Return the String serialization of a given object<O> Stringmarshal(O[] array) Return the String serialization of a given array<T extends OutputStream,O>
Tmarshal(O object, T stream) Write the serialization of a given resource to a givenOutputStream.voidregisterSubtypes(Class<?> classes) <O> Ounmarshal(Class<O> clz, InputStream stream) Creates a resource of given class from its serialization in a givenInputStream.<O> OCreates a resource of given class from its serialization in a givenReader.<O> OCreates a resource of given class from its serialization in a given String<O> List<O>unmarshalList(Class<O> clz, String string) <O> List<O>unmarshalList(String string)
-
Field Details
-
mapper
protected final org.gcube.com.fasterxml.jackson.databind.ObjectMapper mapper -
CLASS_PROPERTY
- See Also:
-
instance
-
-
Method Details
-
getInstance
-
registerSubtypes
-
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 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 <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 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 <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 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 <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 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 <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 resourcestring-- Returns:
- the resource
- Throws:
org.gcube.com.fasterxml.jackson.core.JsonParseExceptionorg.gcube.com.fasterxml.jackson.databind.JsonMappingExceptionIOException
-
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.JsonParseExceptionorg.gcube.com.fasterxml.jackson.databind.JsonMappingExceptionIOException
-
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.JsonParseExceptionorg.gcube.com.fasterxml.jackson.databind.JsonMappingExceptionIOException
-