|
JSON Version 1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.jackson.map.JsonNode
public abstract class JsonNode
Base class for all JSON nodes, used with the "dynamic" (JSON type) mapper
Constructor Summary | |
---|---|
protected |
JsonNode()
|
Method Summary | |
---|---|
void |
appendElement(JsonNode node)
|
abstract boolean |
equals(Object o)
Let's mark this standard method as abstract to ensure all implementation classes define it |
boolean |
getBooleanValue()
|
BigDecimal |
getDecimalValue()
|
double |
getDoubleValue()
|
Iterator<JsonNode> |
getElements()
|
JsonNode |
getElementValue(int index)
Method for accessing value of the specified element of an array node. |
Iterator<String> |
getFieldNames()
|
JsonNode |
getFieldValue(String fieldName)
Method for accessing value of the specified field of an object node. |
Iterator<JsonNode> |
getFieldValues()
|
int |
getIntValue()
|
long |
getLongValue()
|
Number |
getNumberValue()
|
abstract JsonNode |
getPath(int index)
This method is similar to getElementValue(int) , except
that instead of returning null if no such element exists (due
to index being out of range, or this node not being an array),
a "missing node" (node that returns true for
isMissingNode() ) will be returned. |
abstract JsonNode |
getPath(String fieldName)
This method is similar to getFieldValue(java.lang.String) , except
that instead of returning null if no such value exists (due
to this node not being an object, or object not having value
for the specified field),
a "missing node" (node that returns true for
isMissingNode() ) will be returned. |
String |
getTextValue()
|
abstract String |
getValueAsText()
Method that will return valid String representation of the container value, if the node is a value node (method isValueNode() returns true), otherwise null. |
void |
insertElement(int index,
JsonNode value)
|
boolean |
isArray()
|
boolean |
isBigDecimal()
|
boolean |
isBoolean()
|
boolean |
isContainerNode()
Method that returns true for container nodes: Arrays and Objects. |
boolean |
isDouble()
|
boolean |
isFloatingPointNumber()
|
boolean |
isInt()
|
boolean |
isIntegralNumber()
|
boolean |
isLong()
|
boolean |
isMissingNode()
Method that returns true for "virtual" nodes which represent missing entries constructed by path accessor methods when there is no actual node matching given criteria. |
boolean |
isNull()
|
boolean |
isNumber()
|
boolean |
isObject()
|
boolean |
isTextual()
|
boolean |
isValueNode()
Method that returns true for all value nodes: ones that are not containers, and that do not represent "missing" nodes in the path. |
JsonNode |
removeElement(int index)
|
JsonNode |
removeElement(String fieldName)
|
protected JsonNode |
reportNoArrayMods()
|
protected JsonNode |
reportNoObjectMods()
|
JsonNode |
setElement(int index,
JsonNode value)
|
JsonNode |
setElement(String fieldName,
JsonNode value)
|
int |
size()
|
abstract String |
toString()
Let's mark this standard method as abstract to ensure all implementation classes define it |
abstract void |
writeTo(JsonGenerator jg)
Method that can be called to serialize this node and all of its descendants using specified JSON generator. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected JsonNode()
Method Detail |
---|
public boolean isValueNode()
Note: one and only one of methods isValueNode()
,
isContainerNode()
and isMissingNode()
ever
returns true for any given node.
public boolean isContainerNode()
Note: one and only one of methods isValueNode()
,
isContainerNode()
and isMissingNode()
ever
returns true for any given node.
public boolean isMissingNode()
Note: one and only one of methods isValueNode()
,
isContainerNode()
and isMissingNode()
ever
returns true for any given node.
public boolean isArray()
public boolean isObject()
public boolean isNumber()
public boolean isIntegralNumber()
public boolean isFloatingPointNumber()
public boolean isInt()
public boolean isLong()
public boolean isDouble()
public boolean isBigDecimal()
public boolean isTextual()
public boolean isBoolean()
public boolean isNull()
public String getTextValue()
public boolean getBooleanValue()
public Number getNumberValue()
public int getIntValue()
public long getLongValue()
public double getDoubleValue()
public BigDecimal getDecimalValue()
public JsonNode getElementValue(int index)
public JsonNode getFieldValue(String fieldName)
public abstract String getValueAsText()
isValueNode()
returns true), otherwise null.
Note: to serialize nodes of any type, you should call
toString()
instead.
public int size()
public Iterator<JsonNode> getElements()
public Iterator<String> getFieldNames()
public Iterator<JsonNode> getFieldValues()
public void appendElement(JsonNode node)
public void insertElement(int index, JsonNode value)
public JsonNode removeElement(int index)
public JsonNode removeElement(String fieldName)
public JsonNode setElement(int index, JsonNode value)
public JsonNode setElement(String fieldName, JsonNode value)
public abstract JsonNode getPath(String fieldName)
getFieldValue(java.lang.String)
, except
that instead of returning null if no such value exists (due
to this node not being an object, or object not having value
for the specified field),
a "missing node" (node that returns true for
isMissingNode()
) will be returned. This allows for
convenient and safe chained access via path calls.
public abstract JsonNode getPath(int index)
getElementValue(int)
, except
that instead of returning null if no such element exists (due
to index being out of range, or this node not being an array),
a "missing node" (node that returns true for
isMissingNode()
) will be returned. This allows for
convenient and safe chained access via path calls.
public abstract void writeTo(JsonGenerator jg) throws IOException, JsonGenerationException
IOException
JsonGenerationException
public abstract String toString()
toString
in class Object
public abstract boolean equals(Object o)
equals
in class Object
protected JsonNode reportNoArrayMods()
protected JsonNode reportNoObjectMods()
|
JSON Version 1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |