public final class ObjectNode extends ContainerNode<ObjectNode>
ObjectNode
We override it to make it final (the original implementation
isn't), which also allows for code simplification all around.
ContainerNode.NoNodesIterator, ContainerNode.NoStringsIterator_nodeFactoryNO_NODES, NO_STRINGS| Constructor and Description |
|---|
ObjectNode(JsonNodeFactory nc) |
| Modifier and Type | Method and Description |
|---|---|
JsonToken |
asToken() |
ObjectNode |
deepCopy() |
Iterator<JsonNode> |
elements() |
boolean |
equals(Object o) |
Iterator<String> |
fieldNames() |
Iterator<Map.Entry<String,JsonNode>> |
fields()
Method to use for accessing all fields (with both names
and values) of this JSON Object.
|
ObjectNode |
findParent(String fieldName) |
List<JsonNode> |
findParents(String fieldName,
List<JsonNode> foundSoFar) |
JsonNode |
findValue(String fieldName) |
List<JsonNode> |
findValues(String fieldName,
List<JsonNode> foundSoFar) |
List<String> |
findValuesAsText(String fieldName,
List<String> foundSoFar) |
JsonNode |
get(int index) |
JsonNode |
get(String fieldName) |
int |
hashCode() |
boolean |
isObject() |
JsonNode |
path(int index) |
JsonNode |
path(String fieldName) |
ObjectNode |
put(String fieldName,
BigDecimal v)
Method for setting value of a field to specified numeric value.
|
ObjectNode |
put(String fieldName,
boolean v)
Method for setting value of a field to specified String value.
|
ObjectNode |
put(String fieldName,
Boolean value)
Alternative method that we need to avoid bumping into NPE issues
with auto-unboxing.
|
ObjectNode |
put(String fieldName,
byte[] v)
Method for setting value of a field to specified binary value
|
ObjectNode |
put(String fieldName,
double v)
Method for setting value of a field to specified numeric value.
|
ObjectNode |
put(String fieldName,
Double value)
Alternative method that we need to avoid bumping into NPE issues
with auto-unboxing.
|
ObjectNode |
put(String fieldName,
float v)
Method for setting value of a field to specified numeric value.
|
ObjectNode |
put(String fieldName,
Float value)
Alternative method that we need to avoid bumping into NPE issues
with auto-unboxing.
|
ObjectNode |
put(String fieldName,
int v)
Method for setting value of a field to specified numeric value.
|
ObjectNode |
put(String fieldName,
Integer value)
Alternative method that we need to avoid bumping into NPE issues
with auto-unboxing.
|
JsonNode |
put(String fieldName,
JsonNode value)
Method that will set specified field, replacing old value, if any.
|
ObjectNode |
put(String fieldName,
long v)
Method for setting value of a field to specified numeric value.
|
ObjectNode |
put(String fieldName,
Long value)
Alternative method that we need to avoid bumping into NPE issues
with auto-unboxing.
|
ObjectNode |
put(String fieldName,
String v)
Method for setting value of a field to specified String value.
|
JsonNode |
putAll(Map<String,JsonNode> properties)
Method for adding given properties to this object node, overriding
any existing values for those properties.
|
JsonNode |
putAll(ObjectNode other)
Method for adding all properties of the given Object, overriding
any existing values for those properties.
|
ArrayNode |
putArray(String fieldName)
Method that will construct an ArrayNode and add it as a
field of this ObjectNode, replacing old value, if any.
|
ObjectNode |
putNull(String fieldName) |
ObjectNode |
putObject(String fieldName)
Method that will construct an ObjectNode and add it as a
field of this ObjectNode, replacing old value, if any.
|
ObjectNode |
putPOJO(String fieldName,
Object pojo) |
ObjectNode |
remove(Collection<String> fieldNames)
Method for removing specified field properties out of
this ObjectNode.
|
JsonNode |
remove(String fieldName)
Method for removing field entry from this ObjectNode.
|
ObjectNode |
removeAll()
Method for removing all field properties, such that this
ObjectNode will contain no properties after call.
|
JsonNode |
replace(String fieldName,
JsonNode value)
Method for replacing value of specific property with passed
value, and returning value (or null if none).
|
ObjectNode |
retain(Collection<String> fieldNames)
Method for removing all field properties out of this ObjectNode
except for ones specified in argument.
|
ObjectNode |
retain(String... fieldNames)
Method for removing all field properties out of this ObjectNode
except for ones specified in argument.
|
void |
serialize(JsonGenerator jgen,
SerializerProvider provider)
Method that can be called to serialize this node and
all of its descendants using specified JSON generator.
|
void |
serializeWithType(JsonGenerator jgen,
SerializerProvider provider,
TypeSerializer typeSer) |
JsonNode |
set(String fieldName,
JsonNode value)
Method that will set specified field, replacing old value, if any.
|
JsonNode |
setAll(Map<String,JsonNode> properties)
Method for adding given properties to this object node, overriding
any existing values for those properties.
|
JsonNode |
setAll(ObjectNode other)
Method for adding all properties of the given Object, overriding
any existing values for those properties.
|
int |
size() |
String |
toString() |
ObjectNode |
with(String propertyName) |
ArrayNode |
withArray(String propertyName) |
ObjectNode |
without(Collection<String> fieldNames)
Method for removing specified field properties out of
this ObjectNode.
|
JsonNode |
without(String fieldName)
Method for removing field entry from this ObjectNode, and
returning instance after removal.
|
arrayNode, asText, binaryNode, binaryNode, booleanNode, isContainerNode, nullNode, numberNode, numberNode, numberNode, numberNode, numberNode, numberNode, numberNode, objectNode, POJONode, textNodefindPath, numberType, traverseasBoolean, asBoolean, asDouble, asDouble, asInt, asInt, asLong, asLong, bigIntegerValue, binaryValue, booleanValue, canConvertToInt, canConvertToLong, decimalValue, doubleValue, findParents, findValues, findValuesAsText, has, has, hasNonNull, hasNonNull, intValue, isArray, isBigDecimal, isBigInteger, isBinary, isBoolean, isDouble, isFloatingPointNumber, isInt, isIntegralNumber, isLong, isMissingNode, isNull, isNumber, isPojo, isTextual, isValueNode, iterator, longValue, numberValue, textValuepublic ObjectNode(JsonNodeFactory nc)
public ObjectNode deepCopy()
public JsonToken asToken()
asToken in interface TreeNodeasToken in class ContainerNode<ObjectNode>public int size()
size in class ContainerNode<ObjectNode>public JsonNode get(int index)
get in class ContainerNode<ObjectNode>public JsonNode get(String fieldName)
get in class ContainerNode<ObjectNode>public Iterator<String> fieldNames()
fieldNames in class JsonNodepublic Iterator<Map.Entry<String,JsonNode>> fields()
public ObjectNode with(String propertyName)
public JsonNode findValue(String fieldName)
findValue in class ContainerNode<ObjectNode>public List<JsonNode> findValues(String fieldName, List<JsonNode> foundSoFar)
findValues in class ContainerNode<ObjectNode>public List<String> findValuesAsText(String fieldName, List<String> foundSoFar)
findValuesAsText in class ContainerNode<ObjectNode>public ObjectNode findParent(String fieldName)
findParent in class ContainerNode<ObjectNode>public List<JsonNode> findParents(String fieldName, List<JsonNode> foundSoFar)
findParents in class ContainerNode<ObjectNode>public void serialize(JsonGenerator jgen, SerializerProvider provider) throws IOException
serialize in interface JsonSerializableserialize in class BaseJsonNodeIOExceptionpublic void serializeWithType(JsonGenerator jgen, SerializerProvider provider, TypeSerializer typeSer) throws IOException
serializeWithType in interface JsonSerializableserializeWithType in class BaseJsonNodeIOExceptionpublic JsonNode set(String fieldName, JsonNode value)
replace(String, JsonNode),
except for return value.
NOTE: added to replace those uses of put(String, JsonNode)
where chaining with 'this' is desired.
value - to set field to; if null, will be converted
to a NullNode first (to remove field entry, call
remove(java.lang.String) instead)public JsonNode setAll(Map<String,JsonNode> properties)
properties - Properties to addpublic JsonNode setAll(ObjectNode other)
other - Object of which properties to add to this objectpublic JsonNode replace(String fieldName, JsonNode value)
fieldName - Property of which value to replacevalue - Value to set property to, replacing old value if anypublic JsonNode without(String fieldName)
public ObjectNode without(Collection<String> fieldNames)
fieldNames - Names of fields to removepublic JsonNode put(String fieldName, JsonNode value)
value - to set field to; if null, will be converted
to a NullNode first (to remove field entry, call
remove(java.lang.String) instead)
NOTE: this method will be deprecated in 2.2; and should
be replace with either
set(String, JsonNode) or replace(String, JsonNode),
depending on which return value is desired for possible chaining.
public JsonNode remove(String fieldName)
public ObjectNode remove(Collection<String> fieldNames)
fieldNames - Names of fields to removepublic ObjectNode removeAll()
removeAll in class ContainerNode<ObjectNode>public JsonNode putAll(Map<String,JsonNode> properties)
NOTE: this method will be deprecated in 2.2; and should
be replace with setAll(Map).
properties - Properties to addpublic JsonNode putAll(ObjectNode other)
NOTE: this method will be deprecated in 2.2; and should
be replace with setAll(ObjectNode).
other - Object of which properties to add to this objectpublic ObjectNode retain(Collection<String> fieldNames)
fieldNames - Fields to retain in this ObjectNodepublic ObjectNode retain(String... fieldNames)
fieldNames - Fields to retain in this ObjectNodepublic ArrayNode putArray(String fieldName)
NOTE: Unlike all put(...) methods, return value
is NOT this ObjectNode, but the
newly created ArrayNode instance.
public ObjectNode putObject(String fieldName)
NOTE: Unlike all put(...) methods, return value
is NOT this ObjectNode, but the
newly created ObjectNode instance.
public ObjectNode putPOJO(String fieldName, Object pojo)
public ObjectNode putNull(String fieldName)
public ObjectNode put(String fieldName, int v)
public ObjectNode put(String fieldName, Integer value)
public ObjectNode put(String fieldName, long v)
public ObjectNode put(String fieldName, Long value)
public ObjectNode put(String fieldName, float v)
public ObjectNode put(String fieldName, Float value)
public ObjectNode put(String fieldName, double v)
public ObjectNode put(String fieldName, Double value)
public ObjectNode put(String fieldName, BigDecimal v)
public ObjectNode put(String fieldName, String v)
public ObjectNode put(String fieldName, boolean v)
public ObjectNode put(String fieldName, Boolean value)
public ObjectNode put(String fieldName, byte[] v)
Copyright © 2013. All Rights Reserved.