public abstract class ObjectCodec extends Object
JacksonParser and
JsonGenerator use to serialize and deserialize regular
Java objects (POJOs aka Beans).
The standard implementation of this class is
com.fasterxml.jackson.databind.ObjectMapper,
defined in the "jackson-databind".
| 限定符和类型 | 方法和说明 |
|---|---|
abstract TreeNode |
createArrayNode()
Method for construct root level Array nodes
for Tree Model instances.
|
abstract TreeNode |
createObjectNode()
Method for construct root level Object nodes
for Tree Model instances.
|
abstract JsonFactory |
getJsonFactory()
Accessor for finding
JsonFactory codec will use. |
abstract <T extends TreeNode> |
readTree(JacksonParser jp)
Method to deserialize JSON content as tree expressed
using set of
TreeNode instances. |
abstract <T> T |
readValue(JacksonParser jp,
Class<T> valueType)
Method to deserialize JSON content into a non-container
type (it can be an array type, however): typically a bean, array
or a wrapper type (like
Boolean). |
abstract <T> T |
readValue(JacksonParser jp,
ResolvedType valueType)
Method to deserialize JSON content into a POJO, type specified
with fully resolved type object (so it can be a generic type,
including containers like
Collection and
Map). |
abstract <T> T |
readValue(JacksonParser jp,
TypeReference<?> valueTypeRef)
Method to deserialize JSON content into a Java type, reference
to which is passed as argument.
|
abstract <T> Iterator<T> |
readValues(JacksonParser jp,
Class<T> valueType)
Method for reading sequence of Objects from parser stream,
all with same specified value type.
|
abstract <T> Iterator<T> |
readValues(JacksonParser jp,
ResolvedType valueType)
Method for reading sequence of Objects from parser stream,
all with same specified value type.
|
abstract <T> Iterator<T> |
readValues(JacksonParser jp,
TypeReference<?> valueTypeRef)
Method for reading sequence of Objects from parser stream,
all with same specified value type.
|
abstract JacksonParser |
treeAsTokens(TreeNode n)
Method for constructing a
JacksonParser for reading
contents of a JSON tree, as if it was external serialized
JSON content. |
abstract <T> T |
treeToValue(TreeNode n,
Class<T> valueType)
Convenience method for converting given JSON tree into instance of specified
value type.
|
abstract void |
writeValue(JsonGenerator jgen,
Object value)
Method to serialize given Java Object, using generator
provided.
|
public abstract <T> T readValue(JacksonParser jp, Class<T> valueType) throws IOException, JsonProcessingException
Boolean).
Note: this method should NOT be used if the result type is a
container (Collection or Map.
The reason is that due to type erasure, key and value types
can not be introspected when using this method.
public abstract <T> T readValue(JacksonParser jp, TypeReference<?> valueTypeRef) throws IOException, JsonProcessingException
public abstract <T> T readValue(JacksonParser jp, ResolvedType valueType) throws IOException, JsonProcessingException
Collection and
Map).public abstract <T extends TreeNode> T readTree(JacksonParser jp) throws IOException, JsonProcessingException
TreeNode instances. Returns
root of the resulting tree (where root can consist
of just a single node if the current event is a
value event, not container).public abstract <T> Iterator<T> readValues(JacksonParser jp, Class<T> valueType) throws IOException, JsonProcessingException
public abstract <T> Iterator<T> readValues(JacksonParser jp, TypeReference<?> valueTypeRef) throws IOException, JsonProcessingException
public abstract <T> Iterator<T> readValues(JacksonParser jp, ResolvedType valueType) throws IOException, JsonProcessingException
public abstract void writeValue(JsonGenerator jgen, Object value) throws IOException, JsonProcessingException
public abstract TreeNode createObjectNode()
public abstract TreeNode createArrayNode()
public abstract JacksonParser treeAsTokens(TreeNode n)
JacksonParser for reading
contents of a JSON tree, as if it was external serialized
JSON content.public abstract <T> T treeToValue(TreeNode n, Class<T> valueType) throws JsonProcessingException
JacksonParser to
iterate over contents of the tree, and using that parser for data binding.public abstract JsonFactory getJsonFactory()
JsonFactory codec will use.Copyright © 2002–2019 The MyMMSCs Software Foundation. All rights reserved.