本文整理了Java中com.fasterxml.jackson.databind.node.ObjectNode.nullNode()
方法的一些代码示例,展示了ObjectNode.nullNode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectNode.nullNode()
方法的具体详情如下:
包路径:com.fasterxml.jackson.databind.node.ObjectNode
类名称:ObjectNode
方法名:nullNode
暂无
代码示例来源:origin: redisson/redisson
/**
* @return This node (to allow chaining)
*/
public ObjectNode putNull(String fieldName)
{
_children.put(fieldName, nullNode());
return this;
}
代码示例来源:origin: redisson/redisson
/**
* Method for replacing value of specific property with passed
* value, and returning value (or null if none).
*
* @param fieldName Property of which value to replace
* @param value Value to set property to, replacing old value if any
*
* @return Old value of the property; null if there was no such property
* with value
*
* @since 2.1
*/
public JsonNode replace(String fieldName, JsonNode value)
{
if (value == null) { // let's not store 'raw' nulls but nodes
value = nullNode();
}
return _children.put(fieldName, value);
}
代码示例来源:origin: redisson/redisson
/**
* Method that will set specified field, replacing old value, if any.
* Note that this is identical to {@link #replace(String, JsonNode)},
* except for return value.
*<p>
* NOTE: added to replace those uses of {@link #put(String, JsonNode)}
* where chaining with 'this' is desired.
*
* @param value to set field to; if null, will be converted
* to a {@link NullNode} first (to remove field entry, call
* {@link #remove} instead)
*
* @return This node after adding/replacing property value (to allow chaining)
*
* @since 2.1
*/
public JsonNode set(String fieldName, JsonNode value)
{
if (value == null) {
value = nullNode();
}
_children.put(fieldName, value);
return this;
}
代码示例来源:origin: redisson/redisson
/**
* Method that will set specified field, replacing old value, if any.
*
* @param value to set field to; if null, will be converted
* to a {@link NullNode} first (to remove field entry, call
* {@link #remove} instead)
*
* @return Old value of the field, if any; null if there was no
* old value.
*
* @deprecated Since 2.4 use either {@link #set(String,JsonNode)} or {@link #replace(String,JsonNode)},
*/
@Deprecated
public JsonNode put(String fieldName, JsonNode value)
{
if (value == null) { // let's not store 'raw' nulls but nodes
value = nullNode();
}
return _children.put(fieldName, value);
}
代码示例来源:origin: redisson/redisson
/**
* Method for adding given properties to this object node, overriding
* any existing values for those properties.
*
* @param properties Properties to add
*
* @return This node after adding/replacing property values (to allow chaining)
*
* @since 2.1
*/
public JsonNode setAll(Map<String,? extends JsonNode> properties)
{
for (Map.Entry<String,? extends JsonNode> en : properties.entrySet()) {
JsonNode n = en.getValue();
if (n == null) {
n = nullNode();
}
_children.put(en.getKey(), n);
}
return this;
}
代码示例来源:origin: redisson/redisson
/**
* Alternative method that we need to avoid bumping into NPE issues
* with auto-unboxing.
*
* @return This node (to allow chaining)
*/
public ObjectNode put(String fieldName, Short v) {
return _put(fieldName, (v == null) ? nullNode()
: numberNode(v.shortValue()));
}
代码示例来源:origin: redisson/redisson
/**
* Alternative method that we need to avoid bumping into NPE issues
* with auto-unboxing.
*
* @return This node (to allow chaining)
*/
public ObjectNode put(String fieldName, Boolean v) {
return _put(fieldName, (v == null) ? nullNode()
: booleanNode(v.booleanValue()));
}
代码示例来源:origin: redisson/redisson
/**
* Alternative method that we need to avoid bumping into NPE issues
* with auto-unboxing.
*
* @return This node (to allow chaining)
*/
public ObjectNode put(String fieldName, Integer v) {
return _put(fieldName, (v == null) ? nullNode()
: numberNode(v.intValue()));
}
代码示例来源:origin: redisson/redisson
/**
* Alternative method that we need to avoid bumping into NPE issues
* with auto-unboxing.
*
* @return This node (to allow chaining)
*/
public ObjectNode put(String fieldName, Float v) {
return _put(fieldName, (v == null) ? nullNode()
: numberNode(v.floatValue()));
}
代码示例来源:origin: redisson/redisson
/**
* Alternative method that we need to avoid bumping into NPE issues
* with auto-unboxing.
*
* @return This node (to allow chaining)
*/
public ObjectNode put(String fieldName, Double v) {
return _put(fieldName, (v == null) ? nullNode()
: numberNode(v.doubleValue()));
}
代码示例来源:origin: redisson/redisson
/**
* Method for setting value of a field to specified numeric value.
*
* @return This node (to allow chaining)
*/
public ObjectNode put(String fieldName, BigDecimal v) {
return _put(fieldName, (v == null) ? nullNode()
: numberNode(v));
}
代码示例来源:origin: redisson/redisson
/**
* Method for setting value of a field to specified String value.
*
* @return This node (to allow chaining)
*/
public ObjectNode put(String fieldName, String v) {
return _put(fieldName, (v == null) ? nullNode()
: textNode(v));
}
代码示例来源:origin: redisson/redisson
/**
* Method for setting value of a field to specified binary value
*
* @return This node (to allow chaining)
*/
public ObjectNode put(String fieldName, byte[] v) {
return _put(fieldName, (v == null) ? nullNode()
: binaryNode(v));
}
代码示例来源:origin: redisson/redisson
/**
* Method for setting value of a field to specified numeric value.
* The underlying {@link JsonNode} that will be added is constructed
* using {@link JsonNodeFactory#numberNode(Long)}, and may be
* "smaller" (like {@link IntNode}) in cases where value fits within
* range of a smaller integral numeric value.
* <p>
* Note that this is alternative to {@link #put(String, long)} needed to avoid
* bumping into NPE issues with auto-unboxing.
*
* @return This node (to allow chaining)
*/
public ObjectNode put(String fieldName, Long v) {
return _put(fieldName, (v == null) ? nullNode()
: numberNode(v.longValue()));
}
代码示例来源:origin: redisson/redisson
/**
* Method for setting value of a field to specified numeric value.
*
* @return This node (to allow chaining)
*
* @since 2.9
*/
public ObjectNode put(String fieldName, BigInteger v) {
return _put(fieldName, (v == null) ? nullNode()
: numberNode(v));
}
代码示例来源:origin: bootique/bootique
@Override
void writeChildValue(String childName, String value) {
JsonNode childNode = value == null ? node.nullNode() : node.textNode(value);
writeChild(childName, childNode);
}
代码示例来源:origin: com.jwebmp.jackson.core/jackson-databind
/**
* @return This node (to allow chaining)
*/
public ObjectNode putNull(String fieldName)
{
_children.put(fieldName, nullNode());
return this;
}
代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all
/**
* Alternative method that we need to avoid bumping into NPE issues
* with auto-unboxing.
*
* @return This node (to allow chaining)
*/
public ObjectNode put(String fieldName, Integer v) {
return _put(fieldName, (v == null) ? nullNode()
: numberNode(v.intValue()));
}
代码示例来源:origin: com.jwebmp.jackson.core/jackson-databind
/**
* Alternative method that we need to avoid bumping into NPE issues
* with auto-unboxing.
*
* @return This node (to allow chaining)
*/
public ObjectNode put(String fieldName, Boolean v) {
return _put(fieldName, (v == null) ? nullNode()
: booleanNode(v.booleanValue()));
}
代码示例来源:origin: com.jwebmp.jackson.core/jackson-databind
/**
* Method for setting value of a field to specified numeric value.
*
* @return This node (to allow chaining)
*/
public ObjectNode put(String fieldName, BigDecimal v) {
return _put(fieldName, (v == null) ? nullNode()
: numberNode(v));
}
内容来源于网络,如有侵权,请联系作者删除!