public class JSONToolsImpl extends Object implements com.anaptecs.jeaf.json.api.JSONTools
| Constructor and Description |
|---|
JSONToolsImpl() |
| Modifier and Type | Method and Description |
|---|---|
com.fasterxml.jackson.databind.ObjectMapper |
getDefaultObjectMapper()
Method returns a JSON
ObjectMapper that is configured as defined using ObjectMapperConfig and
ModuleFactory. |
<T> T |
read(byte[] pBytes,
Class<T> pType)
Method deserializes the passed byte array into an object of the passed type.
|
<T> T |
read(File pFile,
Class<T> pType)
Method deserializes the data from the passed file into an object of the passed type.
|
<T> T |
read(InputStream pInputStream,
Class<T> pType)
Method deserializes the data of passed stream into an object of the passed type.
|
<T> T |
read(Reader pReader,
Class<T> pType)
Method deserializes the data from the passed reader into an object of the passed type.
|
<T> T |
read(String pContent,
Class<T> pType)
Method deserializes the passed string into an object of the passed type.
|
<T> List<T> |
readToList(byte[] pBytes,
Class<T> pType)
Method deserializes the passed string into a
List of objects of the passed type. |
<T> List<T> |
readToList(File pFile,
Class<T> pType)
Method deserializes the data from the passed file into a
List of objects of the passed type. |
<T> List<T> |
readToList(InputStream pInputStream,
Class<T> pType)
Method deserializes the data of passed stream into a
List of objects of the passed type. |
<T> List<T> |
readToList(Reader pReader,
Class<T> pType)
Method deserializes the data from the passed reader into a
List of objects of the passed type. |
<T> List<T> |
readToList(String pJSONString,
Class<T> pType)
Method deserializes the passed string into a
List of objects of the passed type. |
void |
writeObject(Object pObject,
File pFile)
Method serializes the passed object to the passed file.
|
void |
writeObject(Object pObject,
OutputStream pOutputStream)
Method serializes the passed object to the passed stream.
|
void |
writeObject(Object pObject,
Writer pWriter)
Method serializes the passed object to the passed writer.
|
void |
writeObjects(Collection<?> pObjects,
File pFile,
Class<?> pObjectType)
Method serializes the passed
Collection to the passed file. |
void |
writeObjects(Collection<?> pObjects,
OutputStream pOutputStream,
Class<?> pObjectType)
Method serializes the passed
Collection to the passed stream. |
void |
writeObjects(Collection<?> pObjects,
Writer pWriter,
Class<?> pObjectType)
Method serializes the passed
Collection to the passed writer. |
byte[] |
writeObjectsToBytes(Collection<?> pObjects,
Class<?> pObjectType)
Method serializes the passed
Collection as byte array. |
String |
writeObjectsToString(Collection<?> pObjects,
Class<?> pObjectType)
Method serializes the passed
Collection as string. |
byte[] |
writeObjectToBytes(Object pObject)
Method serializes the passed object as byte array.
|
String |
writeObjectToString(Object pObject)
Method serializes the passed object as string.
|
public com.fasterxml.jackson.databind.ObjectMapper getDefaultObjectMapper()
ObjectMapper that is configured as defined using ObjectMapperConfig and
ModuleFactory.getDefaultObjectMapper in interface com.anaptecs.jeaf.json.api.JSONToolsObjectMapper Object mapper that should be used for JSON serialization.public void writeObject(Object pObject, OutputStream pOutputStream) throws com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException
writeObject in interface com.anaptecs.jeaf.json.api.JSONToolspObject - Object that should be serialized as JSON. The parameter may be null.pOutputStream - Stream to which the object should be written. The parameter must not be null.com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException - if an error occurs during serializationpublic void writeObject(Object pObject, Writer pWriter) throws com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException
writeObject in interface com.anaptecs.jeaf.json.api.JSONToolspObject - Object that should be serialized as JSON. The parameter may be null.pWriter - Writer to which the object should be written. The parameter must not be null.com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException - if an error occurs during serializationpublic void writeObject(Object pObject, File pFile) throws com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException
writeObject in interface com.anaptecs.jeaf.json.api.JSONToolspObject - Object that should be serialized as JSON. The parameter may be null.pFile - File to which the object should be written. The parameter must not be null.com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException - if an error occurs during serializationpublic String writeObjectToString(Object pObject) throws com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException
writeObjectToString in interface com.anaptecs.jeaf.json.api.JSONToolspObject - Object that should be serialized as JSON. The parameter may be null.String JSON serialized object as String. The method never returns null.com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException - if an error occurs during serializationpublic byte[] writeObjectToBytes(Object pObject) throws com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException
writeObjectToBytes in interface com.anaptecs.jeaf.json.api.JSONToolspObject - Object that should be serialized as JSON. The parameter may be null.com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException - if an error occurs during serializationpublic void writeObjects(Collection<?> pObjects, OutputStream pOutputStream, Class<?> pObjectType) throws com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException
Collection to the passed stream.writeObjects in interface com.anaptecs.jeaf.json.api.JSONToolspObjects - Collection of objects that should be serialized as JSON. The parameter may be null.pOutputStream - Stream to which the object should be written. The parameter must not be null.pObjectType - Class object representing the type of objects that are inside the collection. As type
info of Java generics is not present at runtime this information has to be passed as additional parameter.com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException - if an error occurs during serializationpublic void writeObjects(Collection<?> pObjects, Writer pWriter, Class<?> pObjectType) throws com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException
Collection to the passed writer.writeObjects in interface com.anaptecs.jeaf.json.api.JSONToolspObjects - Collection of objects that should be serialized as JSON. The parameter may be null.pWriter - Writer to which the object should be written. The parameter must not be null.pObjectType - Class object representing the type of objects that are inside the collection. As type
info of Java generics is not present at runtime this information has to be passed as additional parameter.com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException - if an error occurs during serializationpublic void writeObjects(Collection<?> pObjects, File pFile, Class<?> pObjectType) throws com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException
Collection to the passed file.writeObjects in interface com.anaptecs.jeaf.json.api.JSONToolspObjects - Collection of objects that should be serialized as JSON. The parameter may be null.pFile - File to which the object should be written. The parameter must not be null.pObjectType - Class object representing the type of objects that are inside the collection. As type
info of Java generics is not present at runtime this information has to be passed as additional parameter.com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException - if an error occurs during serializationpublic String writeObjectsToString(Collection<?> pObjects, Class<?> pObjectType) throws com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException
Collection as string.writeObjectsToString in interface com.anaptecs.jeaf.json.api.JSONToolspObjects - Collection of objects that should be serialized as JSON. The parameter may be null.pObjectType - Class object representing the type of objects that are inside the collection. As type
info of Java generics is not present at runtime this information has to be passed as additional parameter.String JSON serialized object as String. The method never returns null.com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException - if an error occurs during serializationpublic byte[] writeObjectsToBytes(Collection<?> pObjects, Class<?> pObjectType) throws com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException
Collection as byte array.writeObjectsToBytes in interface com.anaptecs.jeaf.json.api.JSONToolspObjects - Collection of objects that should be serialized as JSON. The parameter may be null.pObjectType - Class object representing the type of objects that are inside the collection. As type
info of Java generics is not present at runtime this information has to be passed as additional parameter.String JSON serialized object as String. The method never returns null.com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException - if an error occurs during serializationpublic <T> T read(InputStream pInputStream, Class<T> pType) throws com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException
read in interface com.anaptecs.jeaf.json.api.JSONToolspInputStream - Stream from which the data should be read. The parameter must not be null.pType - Type of the object that should be created. The parameter must not be null.com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException - if an error occurs during deserializationpublic <T> T read(Reader pReader, Class<T> pType) throws com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException
read in interface com.anaptecs.jeaf.json.api.JSONToolspReader - Reader from which the data should be read. The parameter must not be null.pType - Type of the object that should be created. The parameter must not be null.com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException - if an error occurs during deserializationpublic <T> T read(File pFile, Class<T> pType) throws com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException
read in interface com.anaptecs.jeaf.json.api.JSONToolspFile - File from which the data should be read. The parameter must not be null.pType - Type of the object that should be created. The parameter must not be null.com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException - if an error occurs during deserializationpublic <T> T read(String pContent, Class<T> pType) throws com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException
read in interface com.anaptecs.jeaf.json.api.JSONToolspContent - String from which the data should be read. The parameter must not be null.pType - Type of the object that should be created. The parameter must not be null.com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException - if an error occurs during deserializationpublic <T> T read(byte[] pBytes,
Class<T> pType)
throws com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException
read in interface com.anaptecs.jeaf.json.api.JSONToolspBytes - Byte array from which the data should be read. The parameter must not be null.pType - Type of the object that should be created. The parameter must not be null.com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException - if an error occurs during deserializationpublic <T> List<T> readToList(InputStream pInputStream, Class<T> pType) throws com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException
List of objects of the passed type.readToList in interface com.anaptecs.jeaf.json.api.JSONToolspInputStream - Stream from which the data should be read. The parameter must not be null.pType - Type of the object that should be created. The parameter must not be null.List List of objects of passed type that was created from the JSON data. The method may return null
if null was serialized.com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException - if an error occurs during deserializationpublic <T> List<T> readToList(Reader pReader, Class<T> pType) throws com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException
List of objects of the passed type.readToList in interface com.anaptecs.jeaf.json.api.JSONToolspReader - Reader from which the data should be read. The parameter must not be null.pType - Type of the object that should be created. The parameter must not be null.List List of objects of passed type that was created from the JSON data. The method may return null
if null was serialized.com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException - if an error occurs during deserializationpublic <T> List<T> readToList(File pFile, Class<T> pType) throws com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException
List of objects of the passed type.readToList in interface com.anaptecs.jeaf.json.api.JSONToolspFile - File from which the data should be read. The parameter must not be null.pType - Type of the object that should be created. The parameter must not be null.List List of objects of passed type that was created from the JSON data. The method may return null
if null was serialized.com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException - if an error occurs during deserializationpublic <T> List<T> readToList(String pJSONString, Class<T> pType) throws com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException
List of objects of the passed type.readToList in interface com.anaptecs.jeaf.json.api.JSONToolspJSONString - String from which the data should be read. The parameter must not be null.pType - Type of the object that should be created. The parameter must not be null.List List of objects of passed type that was created from the JSON data. The method may return null
if null was serialized.com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException - if an error occurs during deserializationpublic <T> List<T> readToList(byte[] pBytes, Class<T> pType) throws com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException
List of objects of the passed type.readToList in interface com.anaptecs.jeaf.json.api.JSONToolspBytes - Byte array from which the data should be read. The parameter must not be null.pType - Type of the object that should be created. The parameter must not be null.List List of objects of passed type that was created from the JSON data. The method may return null
if null was serialized.com.anaptecs.jeaf.xfun.api.errorhandling.JEAFSystemException - if an error occurs during deserializationCopyright © 2022. All rights reserved.