public class MappedObject extends Object
Modifier and Type | Class and Description |
---|---|
protected static interface |
MappedObject.ContentReader<C>
Strategy used to read JSON content.
|
Modifier | Constructor and Description |
---|---|
protected |
MappedObject(com.fasterxml.jackson.databind.JsonNode node,
MethodHandles.Lookup lookup)
Create a new
MappedObject instance. |
Modifier and Type | Method and Description |
---|---|
protected com.fasterxml.jackson.databind.JsonNode |
getNode()
Return the source node of the mapped object.
|
protected static <T extends MappedObject> |
getRoot(Object proxy) |
protected static <T extends MappedObject,C> |
of(C content,
MappedObject.ContentReader<C> reader,
Function<com.fasterxml.jackson.databind.JsonNode,T> factory)
Factory method to create a new
MappedObject instance. |
protected static <T extends MappedObject> |
of(InputStream content,
Function<com.fasterxml.jackson.databind.JsonNode,T> factory)
Factory method to create a new
MappedObject instance. |
protected static <T extends MappedObject> |
of(String content,
Function<com.fasterxml.jackson.databind.JsonNode,T> factory)
Factory method to create a new
MappedObject instance. |
protected static <T> T |
valueAt(Object proxy,
String expression,
Class<T> type) |
protected <T> T |
valueAt(String expression,
Class<T> type)
Get the value at the given JSON path expression as a specific type.
|
protected MappedObject(com.fasterxml.jackson.databind.JsonNode node, MethodHandles.Lookup lookup)
MappedObject
instance.node
- the source nodelookup
- method handle lookupprotected final com.fasterxml.jackson.databind.JsonNode getNode()
protected <T> T valueAt(String expression, Class<T> type)
T
- the data typeexpression
- the JSON path expressiontype
- the desired type. May be a simple JSON type or an interfaceprotected static <T extends MappedObject> T getRoot(Object proxy)
protected static <T extends MappedObject> T of(String content, Function<com.fasterxml.jackson.databind.JsonNode,T> factory) throws IOException
MappedObject
instance.T
- the mapped object typecontent
- the JSON content for the objectfactory
- a factory to create the mapped object from a JsonNode
IOException
- on IO errorprotected static <T extends MappedObject> T of(InputStream content, Function<com.fasterxml.jackson.databind.JsonNode,T> factory) throws IOException
MappedObject
instance.T
- the mapped object typecontent
- the JSON content for the objectfactory
- a factory to create the mapped object from a JsonNode
IOException
- on IO errorprotected static <T extends MappedObject,C> T of(C content, MappedObject.ContentReader<C> reader, Function<com.fasterxml.jackson.databind.JsonNode,T> factory) throws IOException
MappedObject
instance.T
- the mapped object typeC
- the content typecontent
- the JSON content for the objectreader
- the content readerfactory
- a factory to create the mapped object from a JsonNode
IOException
- on IO error