public abstract class ElementMapper extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static Map<String,Class<? extends Element>> |
knownTypes |
protected static org.gcube.com.fasterxml.jackson.databind.ObjectMapper |
mapper |
| Constructor and Description |
|---|
ElementMapper() |
| Modifier and Type | Method and Description |
|---|---|
static org.gcube.com.fasterxml.jackson.databind.JsonNode |
analizeJsonToReplaceType(org.gcube.com.fasterxml.jackson.databind.JsonNode jsonNodeToAnalize,
String typeIdToReplace) |
static org.gcube.com.fasterxml.jackson.databind.ObjectMapper |
getObjectMapper() |
static <El extends Element> |
marshal(El object)
Return the String serialization of a given object
|
static <El extends Element> |
marshal(El[] array)
Return the String serialization of a given array
|
static <T extends OutputStream,ISM extends Element> |
marshal(ISM object,
T stream)
Write the serialization of a given resource to a given
OutputStream . |
static <T extends Writer,ISM extends Element> |
marshal(ISM object,
T writer)
Write the serialization of a given resource to a given
Writer . |
static <El extends Element> |
marshal(List<El> list)
Return the String serialization of a given list
|
static void |
registerPackages(List<Package> packages) |
static void |
registerPackages(Package... packages) |
static <El extends Element> |
registerSubtype(Class<El> clz) |
static <El extends Element> |
registerSubtypes(Class<El> clz,
Class<El> implementationClass) |
static <El extends Element> |
unmarshal(Class<El> clz,
InputStream stream)
Creates a resource of given class from its serialization in a given
InputStream. |
static <El extends Element> |
unmarshal(Class<El> clz,
Reader reader)
Creates a resource of given class from its serialization in a given
Reader. |
static <ISM extends Element> |
unmarshal(Class<ISM> clz,
String string)
Creates a resource of given class from its serialization in a given String
|
static <ISM extends Element> |
unmarshalList(Class<ISM> clz,
String string) |
static <ISM extends Element> |
unmarshalList(String string) |
static <ISM extends Element> |
unmarshalWithReader(Class<ISM> clz,
String string)
Creates a resource of given class from its serialization in a given String
|
protected static final org.gcube.com.fasterxml.jackson.databind.ObjectMapper mapper
public static org.gcube.com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
public static void registerPackages(Package... packages)
public static <El extends Element> void registerSubtypes(Class<El> clz, Class<El> implementationClass)
public static <T extends OutputStream,ISM extends Element> T marshal(ISM object, T stream) throws org.gcube.com.fasterxml.jackson.core.JsonGenerationException, org.gcube.com.fasterxml.jackson.databind.JsonMappingException, IOException
OutputStream .object - the resourcestream - the stream in inputIOExceptionorg.gcube.com.fasterxml.jackson.databind.JsonMappingExceptionorg.gcube.com.fasterxml.jackson.core.JsonGenerationExceptionpublic static <T extends Writer,ISM extends Element> T marshal(ISM object, T writer) throws org.gcube.com.fasterxml.jackson.core.JsonGenerationException, org.gcube.com.fasterxml.jackson.databind.JsonMappingException, IOException
Writer .object - the resourcewriter - the writer in inputIOExceptionorg.gcube.com.fasterxml.jackson.databind.JsonMappingExceptionorg.gcube.com.fasterxml.jackson.core.JsonGenerationExceptionpublic static <El extends Element> String marshal(El object) throws org.gcube.com.fasterxml.jackson.core.JsonProcessingException
object - the object to marshalorg.gcube.com.fasterxml.jackson.core.JsonProcessingExceptionpublic static <El extends Element> String marshal(List<El> list) throws org.gcube.com.fasterxml.jackson.core.JsonProcessingException
list - the list to marshalorg.gcube.com.fasterxml.jackson.core.JsonProcessingExceptionpublic static <El extends Element> String marshal(El[] array) throws org.gcube.com.fasterxml.jackson.core.JsonProcessingException
array - the array to marshalorg.gcube.com.fasterxml.jackson.core.JsonProcessingExceptionpublic static <El extends Element> El unmarshal(Class<El> clz, Reader reader) throws org.gcube.com.fasterxml.jackson.core.JsonParseException, org.gcube.com.fasterxml.jackson.databind.JsonMappingException, IOException
Reader.clz - the class of the resourcereader - the readerorg.gcube.com.fasterxml.jackson.core.JsonParseExceptionorg.gcube.com.fasterxml.jackson.databind.JsonMappingExceptionIOExceptionpublic static <El extends Element> El unmarshal(Class<El> clz, InputStream stream) throws org.gcube.com.fasterxml.jackson.core.JsonParseException, org.gcube.com.fasterxml.jackson.databind.JsonMappingException, IOException
InputStream.clz - the class of the resourcestream - the streamIOExceptionorg.gcube.com.fasterxml.jackson.databind.JsonMappingExceptionorg.gcube.com.fasterxml.jackson.core.JsonParseExceptionpublic static org.gcube.com.fasterxml.jackson.databind.JsonNode analizeJsonToReplaceType(org.gcube.com.fasterxml.jackson.databind.JsonNode jsonNodeToAnalize,
String typeIdToReplace)
throws Exception
Exceptionpublic static <ISM extends Element> ISM unmarshal(Class<ISM> clz, String string) throws org.gcube.com.fasterxml.jackson.core.JsonParseException, org.gcube.com.fasterxml.jackson.databind.JsonMappingException, IOException
clz - the class of the resourcestring - org.gcube.com.fasterxml.jackson.core.JsonParseExceptionorg.gcube.com.fasterxml.jackson.databind.JsonMappingExceptionIOExceptionpublic static <ISM extends Element> ISM unmarshalWithReader(Class<ISM> clz, String string) throws org.gcube.com.fasterxml.jackson.core.JsonParseException, org.gcube.com.fasterxml.jackson.databind.JsonMappingException, IOException
clz - the class of the resourcestring - org.gcube.com.fasterxml.jackson.core.JsonParseExceptionorg.gcube.com.fasterxml.jackson.databind.JsonMappingExceptionIOExceptionpublic static <ISM extends Element> List<ISM> unmarshalList(Class<ISM> clz, String string) throws org.gcube.com.fasterxml.jackson.core.JsonParseException, org.gcube.com.fasterxml.jackson.databind.JsonMappingException, IOException
org.gcube.com.fasterxml.jackson.core.JsonParseExceptionorg.gcube.com.fasterxml.jackson.databind.JsonMappingExceptionIOExceptionpublic static <ISM extends Element> List<ISM> unmarshalList(String string) throws org.gcube.com.fasterxml.jackson.core.JsonParseException, org.gcube.com.fasterxml.jackson.databind.JsonMappingException, IOException
org.gcube.com.fasterxml.jackson.core.JsonParseExceptionorg.gcube.com.fasterxml.jackson.databind.JsonMappingExceptionIOExceptionCopyright © 2020. All Rights Reserved.