public abstract class JsonNode extends Object
@NonNull public static JsonNode createArrayNode(@NonNull List<JsonNode> nodes)
nodes - The nodes in this array. Must not be modified after this method is called.@NonNull public static JsonNode createObjectNode(Map<String,JsonNode> nodes)
nodes - The nodes in this object. Must not be modified after this method is called.@NonNull public static JsonNode createBooleanNode(boolean value)
value - The value of the node.@NonNull public static JsonNode createStringNode(@NonNull String value)
value - The value of the node.@Internal public static JsonNode createNumberNodeImpl(Number value)
value - The raw numeric value.@NonNull public static JsonNode createNumberNode(int value)
value - The value of the node.@NonNull public static JsonNode createNumberNode(long value)
value - The value of the node.@NonNull public static JsonNode createNumberNode(@NonNull BigDecimal value)
value - The value of the node.@NonNull public static JsonNode createNumberNode(float value)
value - The value of the node.@NonNull public static JsonNode createNumberNode(double value)
value - The value of the node.@NonNull public static JsonNode createNumberNode(@NonNull BigInteger value)
value - The value of the node.public boolean isNumber()
true iff this is a number node.@NonNull public Number getNumberValue()
IllegalStateException - if this is not a number node.public final int getIntValue()
int. May lose precision.IllegalStateException - if this is not a number node.public final long getLongValue()
long. May lose precision.IllegalStateException - if this is not a number node.public final float getFloatValue()
float. May lose precision.IllegalStateException - if this is not a number node.public final double getDoubleValue()
double. May lose precision.IllegalStateException - if this is not a number node.@NonNull public final BigInteger getBigIntegerValue()
BigInteger. May lose the decimal part.IllegalStateException - if this is not a number node.@NonNull public final BigDecimal getBigDecimalValue()
BigDecimal.IllegalStateException - if this is not a number node.public boolean isString()
true iff this is a string node.@NonNull public String getStringValue()
IllegalStateException - if this is not a string node.@NonNull public String coerceStringValue()
IllegalStateException - if this node is not a scalar valuepublic boolean isBoolean()
true iff this is a boolean node.public boolean getBooleanValue()
IllegalStateException - if this is not a boolean node.public boolean isNull()
true iff this is the null node.public abstract int size()
0 if this is not a container node.@NonNull public abstract Iterable<JsonNode> values()
Iterable of all values of this array or object node.IllegalStateException - if this is not a container node.@NonNull public abstract Iterable<Map.Entry<String,JsonNode>> entries()
Iterable of all entries of this object node.IllegalStateException - if this is not an object node.public boolean isValueNode()
true iff this node is a value node (string, number, boolean, null).public boolean isContainerNode()
true iff this node is a container node (array or object).public boolean isArray()
true iff this node is an array node.public boolean isObject()
true iff this node is an object node.@Nullable public abstract JsonNode get(@NonNull String fieldName)
fieldName - The field name.null if there is no such field or this is not an object.