public abstract class JsonUnmarshallerContext extends Object
For full support, see JsonUnmarshallerContextImpl
Modifier and Type | Class and Description |
---|---|
static class |
JsonUnmarshallerContext.UnmarshallerType |
Constructor and Description |
---|
JsonUnmarshallerContext() |
Modifier and Type | Method and Description |
---|---|
int |
getCurrentDepth()
Returns the element depth of the parser's current position in the JSON
document being parsed.
|
String |
getCurrentParentElement()
Returns the name of the JSON field that is the nearest parent of the
current context.Returns null by default.
|
com.fasterxml.jackson.core.JsonToken |
getCurrentToken()
Returns the current JsonToken that is to be parsed by the parser.
|
String |
getHeader(String header)
Returns the value of the header with the specified name from the
response, or null if not present.
|
HttpResponse |
getHttpResponse()
Returns the original HttpResponse constructed for this request.
|
com.fasterxml.jackson.core.JsonParser |
getJsonParser()
Returns the JsonParser used for parsing the Json document.
|
String |
getLastParsedParentElement()
This will return the deleted string in stackString when doing update on
the stack.
|
Map<String,String> |
getMetadata()
Returns any metadata collected through metadata expressions while this
context was reading the JSON events from the JSON document.
|
<T> Unmarshaller<T,JsonUnmarshallerContext> |
getUnmarshaller(Class<T> type)
Returns the JsonUnmarshaller for the specified scalar type.
|
<T> Unmarshaller<T,JsonUnmarshallerContext> |
getUnmarshaller(Class<T> type,
JsonUnmarshallerContext.UnmarshallerType unmarshallerType)
Returns the JsonUnmarshaller for requested custom unmarshaller type.
|
boolean |
isInsideResponseHeader()
Returns true if the
JsonUnmarshallerContext is involved in
parsing response headers. |
boolean |
isStartOfDocument()
Returns true if parsing of the Json document is yet to start.
|
com.fasterxml.jackson.core.JsonToken |
nextToken()
Returns the next JsonToken from the JsonParser.
|
com.fasterxml.jackson.core.JsonToken |
peek()
Returns the JsonToken which is to be parsed next.
|
String |
readText()
Returns the text of the current token, or throws an exception if the
current token does not contain text (ex: '{', '}', etc.).
|
void |
registerMetadataExpression(String expression,
int targetDepth,
String storageKey)
Registers an expression, which if matched, will cause the data for the
matching element to be stored in the metadata map under the specified
key.
|
void |
setCurrentHeader(String currentHeader)
Sets the name of the response header that is to be read next.
|
boolean |
testExpression(String expression)
Tests the specified expression (a JSON field name) against the current
position in the JSON document being parsed.
|
boolean |
testExpression(String expression,
int stackDepth)
Tests the specified expression (a JSON field name) against the current
position in the JSON document being parsed, and restricts the expression
to matching at the specified stack depth.
|
public String getHeader(String header)
header
- The name of the header to lookup.public HttpResponse getHttpResponse()
public int getCurrentDepth()
public String readText() throws IOException
IOException
public boolean isStartOfDocument()
public boolean testExpression(String expression)
expression
- The field name to test.public String getCurrentParentElement()
public boolean testExpression(String expression, int stackDepth)
expression
- The field name to test.stackDepth
- The depth in the stack representing where the expression must
start matching in order for this method to return true.public com.fasterxml.jackson.core.JsonToken nextToken() throws IOException
IOException
public com.fasterxml.jackson.core.JsonToken peek() throws IOException
IOException
public com.fasterxml.jackson.core.JsonParser getJsonParser()
public Map<String,String> getMetadata()
public void registerMetadataExpression(String expression, int targetDepth, String storageKey)
expression
- The expression an element must match in order for it's data to
be pulled out and stored in the metadata map.targetDepth
- The depth in the JSON document where the expression match must
start.storageKey
- The key under which to store the matching element's data.public void setCurrentHeader(String currentHeader)
public com.fasterxml.jackson.core.JsonToken getCurrentToken()
public String getLastParsedParentElement()
public boolean isInsideResponseHeader()
JsonUnmarshallerContext
is involved in
parsing response headers. Else returns false. Returns true by default.public <T> Unmarshaller<T,JsonUnmarshallerContext> getUnmarshaller(Class<T> type)
public <T> Unmarshaller<T,JsonUnmarshallerContext> getUnmarshaller(Class<T> type, JsonUnmarshallerContext.UnmarshallerType unmarshallerType)
Copyright © 2020. All rights reserved.