Spring Boot for VMware GemFire
Class JacksonObjectToJsonConverter
java.lang.Object
org.springframework.geode.data.json.converter.support.JacksonObjectToJsonConverter
- All Implemented Interfaces:
org.springframework.core.convert.converter.Converter<Object,,String> ObjectToJsonConverter
- Direct Known Subclasses:
JSONFormatterPdxToJsonConverter
A
ObjectToJsonConverter implementation using Jackson's ObjectMapper to convert
from an Object to a JSON String.- Since:
- 1.3.0
- See Also:
-
JsonTypeInfoJsonGeneratorObjectMapperMapperFeatureTypeDescriptorObjectToJsonConverterPdxInstanceWrapper
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringconvertObjectToJson(Object source) protected com.fasterxml.jackson.databind.ObjectMappernewObjectMapper(Object target) Constructs a new instance of the JacksonObjectMapperclass.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.core.convert.converter.Converter
andThen
-
Field Details
-
AT_TYPE_METADATA_PROPERTY_NAME
- See Also:
-
-
Constructor Details
-
JacksonObjectToJsonConverter
public JacksonObjectToJsonConverter()
-
-
Method Details
-
convert
- Specified by:
convertin interfaceorg.springframework.core.convert.converter.Converter<Object,String> - Parameters:
source-Objectto convert intoJSON.- Returns:
JSONgenerated from the givenObjectusing Jackson'sObjectMapper.- Throws:
IllegalArgumentException- ifsourceis null.org.springframework.core.convert.ConversionFailedException- if aJsonProcessingExceptionis thrown or another error occurs while trying to convert the givenObjecttoJSON.- See Also:
-
ObjectMapperconvertObjectToJson(Object)
-
convertObjectToJson
@NonNull protected String convertObjectToJson(@NonNull Object source) throws com.fasterxml.jackson.core.JsonProcessingException - Parameters:
source-Objectto convert toJSON; must not be null.- Returns:
JSONgenerated from the givenObject.- Throws:
IllegalArgumentException- ifsourceis null.com.fasterxml.jackson.core.JsonProcessingException- if the generation ofJSONfrom the givenObjectresults in an error.- See Also:
-
ObjectMapper.writeValueAsString(Object)newObjectMapper(Object)
-
newObjectMapper
@NonNull protected com.fasterxml.jackson.databind.ObjectMapper newObjectMapper(@NonNull Object target) Constructs a new instance of the JacksonObjectMapperclass.- Returns:
- a new instance of the Jackson
ObjectMapperclass. - See Also:
-
ObjectMapper
-