|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.jackson.JsonNode
org.codehaus.jackson.node.BaseJsonNode
org.codehaus.jackson.node.ValueNode
org.codehaus.jackson.node.NumericNode
public abstract class NumericNode
Intermediate value node used for numeric nodes.
Field Summary |
---|
Fields inherited from class org.codehaus.jackson.JsonNode |
---|
NO_NODES, NO_STRINGS |
Constructor Summary | |
---|---|
protected |
NumericNode()
|
Method Summary | |
---|---|
abstract BigInteger |
getBigIntegerValue()
|
abstract BigDecimal |
getDecimalValue()
|
abstract double |
getDoubleValue()
|
abstract int |
getIntValue()
Returns integer value for this node, if and only if this node is numeric ( JsonNode.isNumber() returns true). |
abstract long |
getLongValue()
|
abstract 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 Number |
getNumberValue()
Returns numeric value for this node, if and only if this node is numeric ( JsonNode.isNumber() returns true); otherwise
returns null |
double |
getValueAsDouble()
Method that will try to convert value of this node to a Java double. |
double |
getValueAsDouble(double defaultValue)
Method that will try to convert value of this node to a Java double. |
int |
getValueAsInt()
Method that will try to convert value of this node to a Java int. |
int |
getValueAsInt(int defaultValue)
Method that will try to convert value of this node to a Java int. |
long |
getValueAsLong()
Method that will try to convert value of this node to a Java long. |
long |
getValueAsLong(long defaultValue)
Method that will try to convert value of this node to a Java long. |
abstract String |
getValueAsText()
Method that will return valid String representation of the container value, if the node is a value node (method JsonNode.isValueNode() returns true), otherwise null. |
boolean |
isNumber()
|
Methods inherited from class org.codehaus.jackson.node.ValueNode |
---|
asToken, isValueNode, path, path, serializeWithType, toString |
Methods inherited from class org.codehaus.jackson.node.BaseJsonNode |
---|
findParent, findParents, findPath, findValue, findValues, findValuesAsText, serialize, traverse, writeTo |
Methods inherited from class org.codehaus.jackson.JsonNode |
---|
equals, findParents, findValues, findValuesAsText, get, get, getBinaryValue, getBooleanValue, getElements, getElementValue, getFieldNames, getFields, getFieldValue, getPath, getPath, getTextValue, getValueAsBoolean, getValueAsBoolean, has, has, isArray, isBigDecimal, isBigInteger, isBinary, isBoolean, isContainerNode, isDouble, isFloatingPointNumber, isInt, isIntegralNumber, isLong, isMissingNode, isNull, isObject, isPojo, isTextual, iterator, size, with |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected NumericNode()
Method Detail |
---|
public final boolean isNumber()
isNumber
in class JsonNode
public abstract JsonParser.NumberType getNumberType()
JsonNode
JsonNode.isNumber()
),
returns native type that node uses to store the numeric
value.
getNumberType
in class BaseJsonNode
public abstract Number getNumberValue()
JsonNode
JsonNode.isNumber()
returns true); otherwise
returns null
getNumberValue
in class JsonNode
public abstract int getIntValue()
JsonNode
JsonNode.isNumber()
returns true). For other
types returns 0.
For floating-point numbers, value is truncated using default
Java coercion, similar to how cast from double to int operates.
getIntValue
in class JsonNode
public abstract long getLongValue()
getLongValue
in class JsonNode
public abstract double getDoubleValue()
getDoubleValue
in class JsonNode
public abstract BigDecimal getDecimalValue()
getDecimalValue
in class JsonNode
public abstract BigInteger getBigIntegerValue()
getBigIntegerValue
in class JsonNode
public abstract String getValueAsText()
JsonNode
JsonNode.isValueNode()
returns true), otherwise null.
Note: to serialize nodes of any type, you should call
JsonNode.toString()
instead.
getValueAsText
in class JsonNode
public int getValueAsInt()
JsonNode
If representation can not be converted to an int (including structured types like Objects and Arrays), default value of 0 will be returned; no exceptions are thrown.
getValueAsInt
in class JsonNode
public int getValueAsInt(int defaultValue)
JsonNode
If representation can not be converted to an int (including structured types like Objects and Arrays), specified defaultValue will be returned; no exceptions are thrown.
getValueAsInt
in class JsonNode
public long getValueAsLong()
JsonNode
If representation can not be converted to an long (including structured types like Objects and Arrays), default value of 0 will be returned; no exceptions are thrown.
getValueAsLong
in class JsonNode
public long getValueAsLong(long defaultValue)
JsonNode
If representation can not be converted to an long (including structured types like Objects and Arrays), specified defaultValue will be returned; no exceptions are thrown.
getValueAsLong
in class JsonNode
public double getValueAsDouble()
JsonNode
If representation can not be converted to an int (including structured types like Objects and Arrays), default value of 0.0 will be returned; no exceptions are thrown.
getValueAsDouble
in class JsonNode
public double getValueAsDouble(double defaultValue)
JsonNode
If representation can not be converted to an int (including structured types like Objects and Arrays), specified defaultValue will be returned; no exceptions are thrown.
getValueAsDouble
in class JsonNode
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |