Class MappedObject
java.lang.Object
org.springframework.boot.buildpack.platform.json.MappedObject
- Direct Known Subclasses:
ContainerStatus
,Image
,ImageConfig
Base class for mapped JSON objects.
- Since:
- 2.3.0
- Author:
- Phillip Webb
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static interface
Strategy used to read JSON content. -
Constructor Summary
ModifierConstructorDescriptionprotected
MappedObject
(com.fasterxml.jackson.databind.JsonNode node, MethodHandles.Lookup lookup) Create a newMappedObject
instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected final com.fasterxml.jackson.databind.JsonNode
getNode()
Return the source node of the mapped object.protected static <T extends MappedObject>
Tprotected static <T extends MappedObject,
C>
Tof
(C content, MappedObject.ContentReader<C> reader, Function<com.fasterxml.jackson.databind.JsonNode, T> factory) Factory method to create a newMappedObject
instance.protected static <T extends MappedObject>
Tof
(InputStream content, Function<com.fasterxml.jackson.databind.JsonNode, T> factory) Factory method to create a newMappedObject
instance.protected static <T extends MappedObject>
TFactory method to create a newMappedObject
instance.protected static <T> T
protected <T> T
Get the value at the given JSON path expression as a specific type.
-
Constructor Details
-
MappedObject
Create a newMappedObject
instance.- Parameters:
node
- the source nodelookup
- method handle lookup
-
-
Method Details
-
getNode
protected final com.fasterxml.jackson.databind.JsonNode getNode()Return the source node of the mapped object.- Returns:
- the source node
-
valueAt
Get the value at the given JSON path expression as a specific type.- Type Parameters:
T
- the data type- Parameters:
expression
- the JSON path expressiontype
- the desired type. May be a simple JSON type or an interface- Returns:
- the value
-
getRoot
-
valueAt
-
of
protected static <T extends MappedObject> T of(String content, Function<com.fasterxml.jackson.databind.JsonNode, T> factory) throws IOExceptionFactory method to create a newMappedObject
instance.- Type Parameters:
T
- the mapped object type- Parameters:
content
- the JSON content for the objectfactory
- a factory to create the mapped object from aJsonNode
- Returns:
- the mapped object
- Throws:
IOException
- on IO error
-
of
protected static <T extends MappedObject> T of(InputStream content, Function<com.fasterxml.jackson.databind.JsonNode, T> factory) throws IOExceptionFactory method to create a newMappedObject
instance.- Type Parameters:
T
- the mapped object type- Parameters:
content
- the JSON content for the objectfactory
- a factory to create the mapped object from aJsonNode
- Returns:
- the mapped object
- Throws:
IOException
- on IO error
-
of
protected static <T extends MappedObject,C> T of(C content, MappedObject.ContentReader<C> reader, Function<com.fasterxml.jackson.databind.JsonNode, T> factory) throws IOExceptionFactory method to create a newMappedObject
instance.- Type Parameters:
T
- the mapped object typeC
- the content type- Parameters:
content
- the JSON content for the objectreader
- the content readerfactory
- a factory to create the mapped object from aJsonNode
- Returns:
- the mapped object
- Throws:
IOException
- on IO error
-