Class JacksonBasedJsonEngine
java.lang.Object
io.github.grumpystuff.grumpyjson.StructuralJsonEngine
io.github.grumpystuff.grumpyjson.JsonEngine
io.github.grumpystuff.grumpyjson.jackson.JacksonBasedJsonEngine
GSON-based implementation of
JsonEngine.-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new JSON engine with standard converters registered. -
Method Summary
Modifier and TypeMethodDescriptiondeserialize(Reader source, Type type) static JacksonBasedJsonEnginefromObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Creates a new JSON engine that uses the specified JacksonObjectMapperfor JSON syntax processing.static JacksonBasedJsonEnginefromObjectReader(com.fasterxml.jackson.databind.ObjectReader objectReader) Creates a new read-only JSON engine that uses the specified JacksonObjectReaderfor JSON syntax processing.static JacksonBasedJsonEnginefromObjectReaderAndWriter(com.fasterxml.jackson.databind.ObjectReader objectReader, com.fasterxml.jackson.databind.ObjectWriter objectWriter) Creates a new JSON engine that uses the specified JacksonObjectReaderandObjectWriterfor JSON syntax processing.static JacksonBasedJsonEnginefromObjectWriter(com.fasterxml.jackson.databind.ObjectWriter objectWriter) Creates a new write-only JSON engine that uses the specified JacksonObjectWriterfor JSON syntax processing.protected abstract com.fasterxml.jackson.databind.JsonNodeReads JSON syntax from the specified source.protected abstract voidWrites JSON syntax to the specified destination.voidMethods inherited from class io.github.grumpystuff.grumpyjson.JsonEngine
deserialize, deserialize, deserialize, deserialize, deserialize, deserialize, deserialize, deserialize, serializeToString, writeToMethods inherited from class io.github.grumpystuff.grumpyjson.StructuralJsonEngine
deserialize, deserialize, deserialize, getDeserializerRegistry, getRegistries, getSerializerRegistry, registerDeserializer, registerDualConverter, registerSerializer, seal, supportsClassForSerialization, supportsTypeForDeserialization, toJsonElement
-
Constructor Details
-
JacksonBasedJsonEngine
public JacksonBasedJsonEngine()Creates a new JSON engine with standard converters registered.
-
-
Method Details
-
deserialize
- Specified by:
deserializein classJsonEngine- Throws:
JsonDeserializationException
-
writeTo
- Specified by:
writeToin classJsonEngine- Throws:
JsonSerializationException
-
readJson
protected abstract com.fasterxml.jackson.databind.JsonNode readJson(Reader source) throws JsonDeserializationException Reads JSON syntax from the specified source.- Parameters:
source- the source to read from- Returns:
- the JSON tree
- Throws:
JsonDeserializationException- on errors
-
writeJson
protected abstract void writeJson(com.fasterxml.jackson.databind.JsonNode json, Writer destination) throws JsonSerializationException Writes JSON syntax to the specified destination.- Parameters:
json- the JSON treedestination- the destination to write to- Throws:
JsonSerializationException- on errors
-
fromObjectMapper
public static JacksonBasedJsonEngine fromObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Creates a new JSON engine that uses the specified JacksonObjectMapperfor JSON syntax processing.- Parameters:
objectMapper- used for reading and writing JSON syntax- Returns:
- the JSON engine
-
fromObjectReaderAndWriter
public static JacksonBasedJsonEngine fromObjectReaderAndWriter(com.fasterxml.jackson.databind.ObjectReader objectReader, com.fasterxml.jackson.databind.ObjectWriter objectWriter) Creates a new JSON engine that uses the specified JacksonObjectReaderandObjectWriterfor JSON syntax processing.- Parameters:
objectReader- used for reading JSON syntaxobjectWriter- used for writing JSON syntax- Returns:
- the JSON engine
-
fromObjectReader
public static JacksonBasedJsonEngine fromObjectReader(com.fasterxml.jackson.databind.ObjectReader objectReader) Creates a new read-only JSON engine that uses the specified JacksonObjectReaderfor JSON syntax processing.- Parameters:
objectReader- used for reading JSON syntax- Returns:
- the read-only JSON engine
-
fromObjectWriter
public static JacksonBasedJsonEngine fromObjectWriter(com.fasterxml.jackson.databind.ObjectWriter objectWriter) Creates a new write-only JSON engine that uses the specified JacksonObjectWriterfor JSON syntax processing.- Parameters:
objectWriter- used for writing JSON syntax- Returns:
- the write-only JSON engine
-