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

x33g5p2x  于11个月前 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(24)

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

ArrayNode.addObject介绍

[英]Method that will construct an ObjectNode and add it at the end of this array node.
[中]方法,该方法将构造ObjectNode并将其添加到此数组节点的末尾。

代码示例

代码示例来源:origin: soabase/exhibitor

for ( String name : childrenNames )
  ObjectNode  node = children.addObject();
  node.put("title", name);
  node.put("key", ZKPaths.makePath(key, name));
context.getExhibitor().getLog().add(ActivityLog.Type.ERROR, "getNode: " + key, e);
ObjectNode  node = children.addObject();
node.put("title", "* Exception *");
node.put("key", ERROR_KEY);

代码示例来源:origin: NGDATA/lilyproject

public byte[] toBytes() {
  ObjectNode node = JsonNodeFactory.instance.objectNode();
  node.put("default", defaultAccess);
  ArrayNode limitsNode = node.putArray("limits");
  for (Entry<String, Long> limit : limits.entrySet()) {
    ObjectNode limitNode = limitsNode.addObject();
    limitNode.put("store", limit.getKey());
    limitNode.put("limit", limit.getValue());
  }
  return JsonFormat.serializeAsBytesSoft(node, "BlobStoreAccessConfig");
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-mapreduce-client-app

@Private
public JsonNode countersToJSON(Counters counters) {
 ObjectMapper mapper = new ObjectMapper();
 ArrayNode nodes = mapper.createArrayNode();
 if (counters != null) {
  for (CounterGroup counterGroup : counters) {
   ObjectNode groupNode = nodes.addObject();
   groupNode.put("NAME", counterGroup.getName());
   groupNode.put("DISPLAY_NAME", counterGroup.getDisplayName());
   ArrayNode countersNode = groupNode.putArray("COUNTERS");
   for (Counter counter : counterGroup) {
    ObjectNode counterNode = countersNode.addObject();
    counterNode.put("NAME", counter.getName());
    counterNode.put("DISPLAY_NAME", counter.getDisplayName());
    counterNode.put("VALUE", counter.getValue());
   }
  }
 }
 return nodes;
}

代码示例来源: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: NGDATA/lilyproject

public static ObjectNode toJson(RecordType recordType, WriteOptions options, Namespaces namespaces,
    boolean includeName) {
  ObjectNode rtNode = JsonNodeFactory.instance.objectNode();
  rtNode.put("id", recordType.getId().toString());
  if (includeName) {
    rtNode.put("name", QNameConverter.toJson(recordType.getName(), namespaces));
  }
  ArrayNode fieldsNode = rtNode.putArray("fields");
  for (FieldTypeEntry entry : recordType.getFieldTypeEntries()) {
    ObjectNode entryNode = fieldsNode.addObject();
    entryNode.put("id", entry.getFieldTypeId().toString());
    entryNode.put("mandatory", entry.isMandatory());
  }
  rtNode.put("version", recordType.getVersion());
  ArrayNode supertypesNode = rtNode.putArray("supertypes");
  for (Map.Entry<SchemaId, Long> supertype : recordType.getSupertypes().entrySet()) {
    ObjectNode entryNode = supertypesNode.addObject();
    entryNode.put("id", supertype.getKey().toString());
    entryNode.put("version", supertype.getValue());
  }
  return rtNode;
}

代码示例来源:origin: io.hops/hadoop-mapreduce-client-app

@Private
public JsonNode countersToJSON(Counters counters) {
 ArrayNode nodes = FACTORY.arrayNode();
 if (counters != null) {
  for (CounterGroup counterGroup : counters) {
   ObjectNode groupNode = nodes.addObject();
   groupNode.put("NAME", counterGroup.getName());
   groupNode.put("DISPLAY_NAME", counterGroup.getDisplayName());
   ArrayNode countersNode = groupNode.putArray("COUNTERS");
   for (Counter counter : counterGroup) {
    ObjectNode counterNode = countersNode.addObject();
    counterNode.put("NAME", counter.getName());
    counterNode.put("DISPLAY_NAME", counter.getDisplayName());
    counterNode.put("VALUE", counter.getValue());
   }
  }
 }
 return nodes;
}

代码示例来源:origin: de.mhus.lib/mhu-lib-core

} else
if (obj instanceof Map<?,?>) {
  ObjectNode objNode = array.addObject();
  setValues(objNode, (Map<?,?>)obj, level );
} else {

代码示例来源:origin: de.mhus.lib/mhu-lib-core

} else
if (obj instanceof Map<?,?>) {
  ObjectNode objNode = array.addObject();
  setValues(objNode, (Map<?,?>)obj, level );
} else {

代码示例来源: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: rdelbru/SIREn

childArray = twig.putArray(ChildPropertyParser.CHILD_PROPERTY);
final ObjectNode e = childArray.addObject();
e.put(OccurPropertyParser.OCCUR_PROPERTY, clause.getOccur().toString());
e.putAll(clause.getQuery().toJson());
 descendantArray = twig.putArray(DescendantPropertyParser.DESCENDANT_PROPERTY);
final ObjectNode e = descendantArray.addObject();
e.put(OccurPropertyParser.OCCUR_PROPERTY, clause.getOccur().toString());
e.put(LevelPropertyParser.LEVEL_PROPERTY, ((DescendantQueryClause) clause).getLevel());

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

childArray = twig.putArray(ChildPropertyParser.CHILD_PROPERTY);
final ObjectNode e = childArray.addObject();
e.put(OccurPropertyParser.OCCUR_PROPERTY, clause.getOccur().toString());
e.putAll(clause.getQuery().toJson());
 descendantArray = twig.putArray(DescendantPropertyParser.DESCENDANT_PROPERTY);
final ObjectNode e = descendantArray.addObject();
e.put(OccurPropertyParser.OCCUR_PROPERTY, clause.getOccur().toString());
e.put(LevelPropertyParser.LEVEL_PROPERTY, ((DescendantQueryClause) clause).getLevel());

相关文章