public abstract class BaseJsonNode extends JsonNode implements java.io.Serializable
JsonNode
implementations.
The main addition here is that we declare that sub-classes must
implement JsonSerializable
.
This simplifies object mapping aspects a bit, as no external serializers are needed.
Since 2.10, all implements have been Serializable
.
JsonSerializable.Base
Modifier and Type | Field and Description |
---|---|
private static long |
serialVersionUID |
Modifier | Constructor and Description |
---|---|
protected |
BaseJsonNode() |
Modifier and Type | Method and Description |
---|---|
abstract com.fasterxml.jackson.core.JsonToken |
asToken()
Method that can be used for efficient type detection
when using stream abstraction for traversing nodes.
|
JsonNode |
findPath(java.lang.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. |
abstract int |
hashCode() |
com.fasterxml.jackson.core.JsonParser.NumberType |
numberType()
Returns code that identifies type of underlying numeric
value, if (and only if) node is a number node.
|
JsonNode |
required(int index) |
JsonNode |
required(java.lang.String fieldName) |
abstract void |
serialize(com.fasterxml.jackson.core.JsonGenerator jgen,
SerializerProvider provider)
Method called to serialize node instances using given generator.
|
abstract void |
serializeWithType(com.fasterxml.jackson.core.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.
|
java.lang.String |
toPrettyString()
Alternative to
JsonNode.toString() that will serialize this node using
Jackson default pretty-printer. |
java.lang.String |
toString()
Method that will produce (as of Jackson 2.10) valid JSON using
default settings of databind, as String.
|
com.fasterxml.jackson.core.JsonParser |
traverse() |
com.fasterxml.jackson.core.JsonParser |
traverse(com.fasterxml.jackson.core.ObjectCodec codec) |
(package private) java.lang.Object |
writeReplace() |
_at, _reportRequiredViolation, _this, asBoolean, asBoolean, asDouble, asDouble, asInt, asInt, asLong, asLong, asText, asText, at, at, bigIntegerValue, binaryValue, booleanValue, canConvertToInt, canConvertToLong, decimalValue, deepCopy, doubleValue, elements, equals, equals, fieldNames, fields, findParent, findParents, findParents, findValue, findValues, findValues, findValuesAsText, findValuesAsText, floatValue, get, get, getNodeType, has, has, hasNonNull, hasNonNull, intValue, isArray, isBigDecimal, isBigInteger, isBinary, isBoolean, isContainerNode, isDouble, isEmpty, isFloat, isFloatingPointNumber, isInt, isIntegralNumber, isLong, isMissingNode, isNull, isNumber, isObject, isPojo, isShort, isTextual, isValueNode, iterator, longValue, numberValue, path, path, require, requiredAt, requiredAt, requireNonNull, shortValue, size, textValue, with, withArray
isEmpty
private static final long serialVersionUID
java.lang.Object writeReplace()
public final JsonNode findPath(java.lang.String fieldName)
JsonNode
JsonNode.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 abstract int hashCode()
hashCode
in class java.lang.Object
public com.fasterxml.jackson.core.JsonParser traverse()
traverse
in interface com.fasterxml.jackson.core.TreeNode
public com.fasterxml.jackson.core.JsonParser traverse(com.fasterxml.jackson.core.ObjectCodec codec)
traverse
in interface com.fasterxml.jackson.core.TreeNode
public abstract com.fasterxml.jackson.core.JsonToken asToken()
JsonToken
that equivalent
stream event would produce (for most nodes there is just
one token but for structured/container types multiple)asToken
in interface com.fasterxml.jackson.core.TreeNode
public com.fasterxml.jackson.core.JsonParser.NumberType numberType()
numberType
in interface com.fasterxml.jackson.core.TreeNode
public abstract void serialize(com.fasterxml.jackson.core.JsonGenerator jgen, SerializerProvider provider) throws java.io.IOException, com.fasterxml.jackson.core.JsonProcessingException
serialize
in interface JsonSerializable
java.io.IOException
com.fasterxml.jackson.core.JsonProcessingException
public abstract void serializeWithType(com.fasterxml.jackson.core.JsonGenerator jgen, SerializerProvider provider, TypeSerializer typeSer) throws java.io.IOException, com.fasterxml.jackson.core.JsonProcessingException
serializeWithType
in interface JsonSerializable
java.io.IOException
com.fasterxml.jackson.core.JsonProcessingException
public java.lang.String toString()
JsonNode
ObjectMapper
or ObjectWriter
to serialize an
instance, for example:
String json = objectMapper.writeValueAsString(rootNode);
Note: method defined as abstract to ensure all implementation
classes explicitly implement method, instead of relying
on Object.toString()
definition.
public java.lang.String toPrettyString()
JsonNode
JsonNode.toString()
that will serialize this node using
Jackson default pretty-printer.toPrettyString
in class JsonNode