public abstract class BaseJsonNode extends JsonNode implements JsonSerializableWithType
JsonNode
implementations.
The main addition here is that we declare that sub-classes must
implement JsonSerializableWithType.
This simplifies object mapping
aspects a bit, as no external serializers are needed.NO_NODES, NO_STRINGS| 限定符 | 构造器和说明 |
|---|---|
protected |
BaseJsonNode() |
| 限定符和类型 | 方法和说明 |
|---|---|
abstract JsonToken |
asToken()
Method that can be used for efficient type detection
when using stream abstraction for traversing nodes.
|
ObjectNode |
findParent(String fieldName)
Method for finding a JSON Object that contains specified field,
within this node or its descendants.
|
List<JsonNode> |
findParents(String fieldName,
List<JsonNode> foundSoFar) |
JsonNode |
findPath(String fieldName)
Method similar to
JsonNode.findValue(java.lang.String), but that will return a
"missing node" instead of null if no field is found. |
JsonNode |
findValue(String fieldName)
Method for finding a JSON Object field with specified name in this
node or its child nodes, and returning value it has.
|
List<JsonNode> |
findValues(String fieldName,
List<JsonNode> foundSoFar) |
List<String> |
findValuesAsText(String fieldName,
List<String> foundSoFar) |
JsonParser.NumberType |
getNumberType()
If this node is a numeric type (as per
JsonNode.isNumber()),
returns native type that node uses to store the numeric
value. |
abstract void |
serialize(JsonGenerator jgen,
SerializerProvider provider)
Method called to serialize node instances using given generator.
|
abstract void |
serializeWithType(JsonGenerator jgen,
SerializerProvider provider,
TypeSerializer typeSer)
Type information is needed, even if JsonNode instances are "plain" JSON,
since they may be mixed with other types.
|
JsonParser |
traverse()
Method for constructing a
JsonParser instance for
iterating over contents of the tree that this
node is root of. |
asBoolean, asBoolean, asDouble, asDouble, asInt, asInt, asLong, asLong, asText, equals, findParents, findValues, findValuesAsText, get, get, getBigIntegerValue, getBinaryValue, getBooleanValue, getDecimalValue, getDoubleValue, getElements, getFieldNames, getFields, getIntValue, getLongValue, getNumberValue, getPath, getPath, getTextValue, getValueAsBoolean, getValueAsBoolean, getValueAsDouble, getValueAsDouble, getValueAsInt, getValueAsInt, getValueAsLong, getValueAsLong, getValueAsText, has, has, isArray, isBigDecimal, isBigInteger, isBinary, isBoolean, isContainerNode, isDouble, isFloatingPointNumber, isInt, isIntegralNumber, isLong, isMissingNode, isNull, isNumber, isObject, isPojo, isTextual, isValueNode, iterator, path, path, size, toString, withpublic JsonNode findValue(String fieldName)
JsonNodepublic final JsonNode findPath(String fieldName)
JsonNodeJsonNode.findValue(java.lang.String), but that will return a
"missing node" instead of null if no field is found. Missing node
is a specific kind of node for which JsonNode.isMissingNode()
returns true; and all value access methods return empty or
missing value.public ObjectNode findParent(String fieldName)
JsonNodefindParent 在类中 JsonNodefieldName - Name of field to look forpublic List<JsonNode> findValues(String fieldName, List<JsonNode> foundSoFar)
findValues 在类中 JsonNodepublic List<String> findValuesAsText(String fieldName, List<String> foundSoFar)
findValuesAsText 在类中 JsonNodepublic List<JsonNode> findParents(String fieldName, List<JsonNode> foundSoFar)
findParents 在类中 JsonNodepublic JsonParser traverse()
JsonNodeJsonParser instance for
iterating over contents of the tree that this
node is root of.
Functionally equivalent to first serializing tree using
ObjectCodec and then re-parsing but
more efficient.public abstract JsonToken asToken()
JsonToken that equivalent
stream event would produce (for most nodes there is just
one token but for structured/container types multiple)public JsonParser.NumberType getNumberType()
JsonNodeJsonNode.isNumber()),
returns native type that node uses to store the numeric
value.getNumberType 在类中 JsonNodepublic abstract void serialize(JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException
serialize 在接口中 JsonSerializableIOExceptionJsonProcessingExceptionpublic abstract void serializeWithType(JsonGenerator jgen, SerializerProvider provider, TypeSerializer typeSer) throws IOException, JsonProcessingException