本文整理匯總了Java中com.fasterxml.jackson.databind.node.ObjectNode.setAll方法的典型用法代碼示例。如果您正苦於以下問題:Java ObjectNode.setAll方法的具體用法?Java ObjectNode.setAll怎麽用?Java ObjectNode.setAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.fasterxml.jackson.databind.node.ObjectNode
的用法示例。
在下文中一共展示了ObjectNode.setAll方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: encode
import com.fasterxml.jackson.databind.node.ObjectNode; //導入方法依賴的package包/類
@Override
public ObjectNode encode(VirtualLink vLink, CodecContext context) {
checkNotNull(vLink, NULL_OBJECT_MSG);
ObjectNode result = context.mapper().createObjectNode()
.put(NETWORK_ID, vLink.networkId().toString());
JsonCodec<Link> codec = context.codec(Link.class);
ObjectNode linkResult = codec.encode(vLink, context);
result.setAll(linkResult);
return result;
}
示例2: buildSummaryReport
import com.fasterxml.jackson.databind.node.ObjectNode; //導入方法依賴的package包/類
protected JsonNode buildSummaryReport(boolean isSecondary) {
// Step 1 - build map with total for services
ObjectNode summaryTotalJson = jacksonMapper.createObjectNode();
ArrayNode cache = summary24HourCache;
if (isSecondary)
cache = summary24HourApplicationCache;
logger.debug("** intervalReports size: {}, isSecondary: {}", cache.size(), isSecondary);
for (JsonNode intervalReport : cache) {
Iterator<String> fields = intervalReport.fieldNames();
while (fields.hasNext()) {
String field = fields.next();
ObjectNode serviceInterval = (ObjectNode) intervalReport.get(field);
if (!summaryTotalJson.has(field))
summaryTotalJson.putObject(field);
ObjectNode serviceSummaryNode = (ObjectNode) summaryTotalJson.get(field);
Iterator<String> subFields = serviceInterval.fieldNames();
while (subFields.hasNext()) {
String subField = subFields.next();
// logger.info(" subField: " + subField);
addItemToTotals(serviceInterval, serviceSummaryNode, subField);
}
}
}
// Step 2 convert to mongo aggregation friendly array
ArrayNode summaryArray = jacksonMapper.createArrayNode();
Iterator<String> serviceNames = summaryTotalJson.fieldNames();
while (serviceNames.hasNext()) {
String serviceName = serviceNames.next();
ObjectNode serviceItem = summaryArray.addObject();
serviceItem.put("serviceName", serviceName);
ObjectNode serviceData = (ObjectNode) summaryTotalJson.get(serviceName);
serviceItem.setAll(serviceData);
}
logger.debug("** Report: {}", summaryArray);
return summaryArray;
}
示例3: buildMetricLabels
import com.fasterxml.jackson.databind.node.ObjectNode; //導入方法依賴的package包/類
private ObjectNode buildMetricLabels() {
ObjectNode labelMapping = JmxCommonEnum.graphLabels();
labelMapping.setAll( OsSharedEnum.graphLabels() );
labelMapping.setAll( OsProcessEnum.graphLabels() );
return labelMapping;
}