@Singleton public class ObjectToJsonNodeConverter extends Object implements TypeConverter<Object,com.fasterxml.jackson.databind.JsonNode>
A TypeConverter
that can convert objects to JSON with Jackson.
Constructor and Description |
---|
ObjectToJsonNodeConverter(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Deprecated.
Use
ObjectToJsonNodeConverter(Provider) instead |
ObjectToJsonNodeConverter(Provider<com.fasterxml.jackson.databind.ObjectMapper> objectMapper) |
Modifier and Type | Method and Description |
---|---|
Optional<com.fasterxml.jackson.databind.JsonNode> |
convert(Object object,
Class<com.fasterxml.jackson.databind.JsonNode> targetType,
ConversionContext context)
Converts from the given source object type to the target type.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
convert, of
@Deprecated public ObjectToJsonNodeConverter(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
ObjectToJsonNodeConverter(Provider)
insteadobjectMapper
- To read/write JSONpublic Optional<com.fasterxml.jackson.databind.JsonNode> convert(Object object, Class<com.fasterxml.jackson.databind.JsonNode> targetType, ConversionContext context)
TypeConverter
Optional.empty()
in case the object is not convertible by catching any necessary exceptions and failing gracefully.convert
in interface TypeConverter<Object,com.fasterxml.jackson.databind.JsonNode>
object
- The object typetargetType
- The target type being converted tocontext
- The ConversionContext