public class NdJsonObjectMapper extends Object
| Constructor and Description |
|---|
NdJsonObjectMapper()
Default constructor, which will construct the default
JsonFactory
as necessary, use SerializerProvider as its
SerializerProvider, and BeanSerializerFactory as its
SerializerFactory. |
NdJsonObjectMapper(com.fasterxml.jackson.core.JsonFactory jf)
Constructs instance that uses specified
JsonFactory for
constructing necessary JsonParsers and/or JsonGenerators. |
NdJsonObjectMapper(com.fasterxml.jackson.core.JsonFactory jf,
com.fasterxml.jackson.databind.ser.DefaultSerializerProvider sp,
com.fasterxml.jackson.databind.deser.DefaultDeserializationContext dc)
Constructs instance that uses specified
JsonFactory for
constructing necessary JsonParsers and/or JsonGenerators,
and uses given providers for accessing serializers and deserializers. |
| Modifier and Type | Method and Description |
|---|---|
<T> Stream<T> |
readValue(InputStream in,
Class<T> valueType)
Method to deserialize JSON Stream into Stream of Java type, reference to
which is passed as argument.
|
<T> List<T> |
readValueAsList(InputStream in,
Class<T> valueType)
Method to deserialize JSON Stream into List of Java type, reference to
which is passed as argument.
|
NdJsonObjectMapper |
registerModule(com.fasterxml.jackson.databind.Module module)
Method for registering a module that can extend functionality provided by
this mapper; for example, by adding providers for custom serializers and
deserializers.
|
NdJsonObjectMapper |
registerModules(com.fasterxml.jackson.databind.Module... modules)
Convenience method for registering specified modules in order;
functionally equivalent to:
|
void |
writeValue(OutputStream out,
List<Object> value)
Method that can be used to serialize any Java List of value as JSON
output, written to OutputStream provided.
|
void |
writeValue(OutputStream out,
Stream<Object> value)
Method that can be used to serialize any Java Stream of value as JSON
output, written to OutputStream provided.
|
public NdJsonObjectMapper()
JsonFactory
as necessary, use SerializerProvider as its
SerializerProvider, and BeanSerializerFactory as its
SerializerFactory. This means that it can serialize all standard
JDK types, as well as regular Java Beans (based on method names and
Jackson-specific annotations), but does not support JAXB annotations.public NdJsonObjectMapper(com.fasterxml.jackson.core.JsonFactory jf)
JsonFactory for
constructing necessary JsonParsers and/or JsonGenerators.jf - JsonFactory to use: if null, a new MappingJsonFactory
will be constructedpublic NdJsonObjectMapper(com.fasterxml.jackson.core.JsonFactory jf,
com.fasterxml.jackson.databind.ser.DefaultSerializerProvider sp,
com.fasterxml.jackson.databind.deser.DefaultDeserializationContext dc)
JsonFactory for
constructing necessary JsonParsers and/or JsonGenerators,
and uses given providers for accessing serializers and deserializers.jf - JsonFactory to use: if null, a new MappingJsonFactory
will be constructedsp - SerializerProvider to use: if null, a
SerializerProvider will be constructeddc - Blueprint deserialization context instance to use for creating
actual context objects; if null, will construct standard
DeserializationContextpublic NdJsonObjectMapper registerModule(com.fasterxml.jackson.databind.Module module)
module - Module to registerpublic NdJsonObjectMapper registerModules(com.fasterxml.jackson.databind.Module... modules)
for (Module module : modules) {
registerModule(module);
}
modules - Modules to registerpublic <T> Stream<T> readValue(InputStream in, Class<T> valueType) throws NdJsonRunTimeException, com.fasterxml.jackson.core.JsonParseException, com.fasterxml.jackson.databind.JsonMappingException
T - The expected class of the Object.in - Input StreamvalueType - Class of ObjectNdJsonRunTimeException - if a low-level I/O problem (unexpected end-of-input, network
error) occurs (passed through as-is without additional
wrappingcom.fasterxml.jackson.core.JsonParseException - if underlying input contains invalid content of type
JsonParser supports (JSON for default case)com.fasterxml.jackson.databind.JsonMappingException - if the input JSON structure does not match structure expected
for result type (or has other mismatch issues)public <T> List<T> readValueAsList(InputStream in, Class<T> valueType) throws NdJsonRunTimeException, com.fasterxml.jackson.core.JsonParseException, com.fasterxml.jackson.databind.JsonMappingException
T - The expected class of the Object.in - Input StreamvalueType - Class of ObjectNdJsonRunTimeException - if a low-level I/O problem (unexpected end-of-input, network
error) occurs (passed through as-is without additional
wrappingcom.fasterxml.jackson.core.JsonParseException - if underlying input contains invalid content of type
JsonParser supports (JSON for default case)com.fasterxml.jackson.databind.JsonMappingException - if the input JSON structure does not match structure expected
for result type (or has other mismatch issues)public void writeValue(OutputStream out, Stream<Object> value) throws NdJsonRunTimeException, com.fasterxml.jackson.core.JsonGenerationException, com.fasterxml.jackson.databind.JsonMappingException
out - Output Streamvalue - Stream of Java ObjectsNdJsonRunTimeException - if a low-level I/O problem (unexpected end-of-input, network
error) occurs (passed through as-is without additional
wrappingcom.fasterxml.jackson.core.JsonGenerationException - Exception type for exceptions during JSON writing, such as
trying to output content in wrong contextcom.fasterxml.jackson.databind.JsonMappingException - if any fatal problems with mapping of content.public void writeValue(OutputStream out, List<Object> value) throws NdJsonRunTimeException, com.fasterxml.jackson.core.JsonGenerationException, com.fasterxml.jackson.databind.JsonMappingException
out - Output Streamvalue - List of Java ObjectsNdJsonRunTimeException - if a low-level I/O problem (unexpected end-of-input, network
error) occurs (passed through as-is without additional
wrappingcom.fasterxml.jackson.core.JsonGenerationException - Exception type for exceptions during JSON writing, such as
trying to output content in wrong contextcom.fasterxml.jackson.databind.JsonMappingException - if any fatal problems with mapping of content.Copyright © 2019. All rights reserved.