org.codehaus.jackson.node.ObjectNode.putAll()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(103)

本文整理了Java中org.codehaus.jackson.node.ObjectNode.putAll()方法的一些代码示例,展示了ObjectNode.putAll()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectNode.putAll()方法的具体详情如下:
包路径:org.codehaus.jackson.node.ObjectNode
类名称:ObjectNode
方法名:putAll

ObjectNode.putAll介绍

[英]Method for adding given properties to this object node, overriding any existing values for those properties.
[中]方法将给定属性添加到此对象节点,并覆盖这些属性的任何现有值。

代码示例

代码示例来源:origin: oVirt/ovirt-engine

/**
 * Applies custom (user-defined) configuration on top of default (descriptor-defined) configuration, and returns the
 * resulting JSON object.
 */
public ObjectNode mergeConfiguration() {
  JsonNode descriptorConfigNode = descriptorNode.path(ATT_CONFIG);
  ObjectNode result = nodeFactory.objectNode();
  // Apply default configuration, if any
  if (!descriptorConfigNode.isMissingNode() && descriptorConfigNode.isObject()) {
    result.putAll((ObjectNode) descriptorConfigNode);
  }
  // Apply custom configuration, if any
  JsonNode customConfigNode = configurationNode.path(ATT_CONFIG);
  if (customConfigNode != null && !customConfigNode.isMissingNode() && customConfigNode.isObject()) {
    result.putAll((ObjectNode) customConfigNode);
  }
  return result;
}

代码示例来源:origin: rdelbru/SIREn

@Override
ObjectNode toJson() {
 final ObjectNode obj = mapper.createObjectNode();
 final ArrayNode bool = obj.putArray(BooleanPropertyParser.BOOLEAN_PROPERTY);
 for (final QueryClause clause : clauses) {
  final ObjectNode e = bool.addObject();
  e.put(OccurPropertyParser.OCCUR_PROPERTY, clause.getOccur().toString());
  e.putAll(clause.getQuery().toJson());
 }
 return obj;
}

代码示例来源:origin: sirensolutions/siren

@Override
public ObjectNode toJson() {
 final ObjectNode obj = mapper.createObjectNode();
 ObjectNode bool = obj.putObject(BooleanPropertyParser.BOOLEAN_PROPERTY);
 // add boost
 if (this.hasBoost()) {
  bool.put(BoostPropertyParser.BOOST_PROPERTY, this.getBoost());
 }
 // add slop
 if (this.hasSlop()) {
  bool.put(SlopPropertyParser.SLOP_PROPERTY, this.getSlop());
 }
 // add inOrder
 if (this.hasInOrder()) {
  bool.put(InOrderPropertyParser.IN_ORDER_PROPERTY, this.getInOrder());
 }
 // add clauses
 ArrayNode array = bool.putArray(ClausePropertyParser.CLAUSE_PROPERTY);
 for (final QueryClause clause : clauses) {
  final ObjectNode e = array.addObject();
  e.put(OccurPropertyParser.OCCUR_PROPERTY, clause.getOccur().toString());
  e.putAll(clause.getQuery().toJson());
 }
 return obj;
}

代码示例来源:origin: sirensolutions/siren

e.putAll(clause.getQuery().toJson());
e.put(OccurPropertyParser.OCCUR_PROPERTY, clause.getOccur().toString());
e.put(LevelPropertyParser.LEVEL_PROPERTY, ((DescendantQueryClause) clause).getLevel());
e.putAll(clause.getQuery().toJson());

代码示例来源:origin: rdelbru/SIREn

e.putAll(clause.getQuery().toJson());
e.put(OccurPropertyParser.OCCUR_PROPERTY, clause.getOccur().toString());
e.put(LevelPropertyParser.LEVEL_PROPERTY, ((DescendantQueryClause) clause).getLevel());
e.putAll(clause.getQuery().toJson());

相关文章