本文整理了Java中com.fasterxml.jackson.databind.node.ArrayNode.toString()
方法的一些代码示例,展示了ArrayNode.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ArrayNode.toString()
方法的具体详情如下:
包路径:com.fasterxml.jackson.databind.node.ArrayNode
类名称:ArrayNode
方法名:toString
暂无
代码示例来源:origin: apache/incubator-pinot
/**
* Get the trace information added so far.
*/
public static String getTraceInfo() {
ArrayNode jsonTraces = JsonUtils.newArrayNode();
for (Trace trace : REQUEST_TO_TRACES_MAP.get(TRACE_ENTRY_THREAD_LOCAL.get()._requestId)) {
jsonTraces.add(trace.toJson());
}
return jsonTraces.toString();
}
代码示例来源:origin: apache/incubator-pinot
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/schemas")
@ApiOperation(value = "List all schema names", notes = "Lists all schema names")
public String listSchemaNames() {
List<String> schemaNames = _pinotHelixResourceManager.getSchemaNames();
ArrayNode ret = JsonUtils.newArrayNode();
if (schemaNames != null) {
for (String schema : schemaNames) {
ret.add(schema);
}
}
return ret.toString();
}
代码示例来源:origin: apache/incubator-pinot
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/segments/{tableName}")
@ApiOperation(value = "Lists names of all segments of a table", notes = "Lists names of all segment names of a table")
public String listAllSegmentNames(
@ApiParam(value = "Name of the table", required = true) @PathParam("tableName") String tableName,
@ApiParam(value = "realtime|offline") @QueryParam("type") String tableTypeStr) {
ArrayNode ret = JsonUtils.newArrayNode();
CommonConstants.Helix.TableType tableType = Constants.validateTableType(tableTypeStr);
if (tableTypeStr == null) {
ret.add(formatSegments(tableName, CommonConstants.Helix.TableType.OFFLINE));
ret.add(formatSegments(tableName, CommonConstants.Helix.TableType.REALTIME));
} else {
ret.add(formatSegments(tableName, tableType));
}
return ret.toString();
}
代码示例来源:origin: apache/incubator-pinot
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/segments")
@Deprecated
public String listAllSegmentNames()
throws Exception {
FileUploadPathProvider provider = new FileUploadPathProvider(_controllerConf);
ArrayNode ret = JsonUtils.newArrayNode();
for (final File file : provider.getBaseDataDir().listFiles()) {
final String fileName = file.getName();
if (fileName.equalsIgnoreCase("fileUploadTemp") || fileName.equalsIgnoreCase("schemasTemp")) {
continue;
}
final String url = _controllerConf.generateVipUrl() + "/segments/" + fileName;
ret.add(url);
}
return ret.toString();
}
代码示例来源:origin: apache/incubator-pinot
private String listSegmentMetadataInternal(@Nonnull String tableName, @Nonnull String segmentName,
@Nullable CommonConstants.Helix.TableType tableType) {
List<String> tableNamesWithType = getExistingTableNamesWithType(tableName, tableType);
ArrayNode result = JsonUtils.newArrayNode();
for (String tableNameWithType : tableNamesWithType) {
ArrayNode segmentMetaData = getSegmentMetaData(tableNameWithType, segmentName);
if (segmentMetaData != null) {
result.add(segmentMetaData);
}
}
if (result.size() == 0) {
String errorMessage = "Failed to find segment: " + segmentName + " in table: " + tableName;
if (tableType != null) {
errorMessage += " of type: " + tableType;
}
throw new ControllerApplicationException(LOGGER, errorMessage, Response.Status.NOT_FOUND);
}
return result.toString();
}
代码示例来源:origin: apache/incubator-pinot
private String getInstanceToSegmentsMap(@Nonnull String tableName,
@Nullable CommonConstants.Helix.TableType tableType) {
List<String> tableNamesWithType = getExistingTableNamesWithType(tableName, tableType);
ArrayNode result = JsonUtils.newArrayNode();
for (String tableNameWithType : tableNamesWithType) {
ObjectNode resultForTable = JsonUtils.newObjectNode();
resultForTable.put(FileUploadPathProvider.TABLE_NAME, tableNameWithType);
try {
// NOTE: for backward-compatibility, we put serialized map string as the value
resultForTable.put("segments",
JsonUtils.objectToString(_pinotHelixResourceManager.getServerToSegmentsMap(tableNameWithType)));
} catch (JsonProcessingException e) {
throw new ControllerApplicationException(LOGGER,
"Caught JSON exception while getting instance to segments map for table: " + tableNameWithType,
Response.Status.INTERNAL_SERVER_ERROR, e);
}
result.add(resultForTable);
}
return result.toString();
}
代码示例来源:origin: apache/incubator-pinot
return ret.toString();
} else {
throw new ControllerApplicationException(LOGGER, "Table '" + tableName + "' does not exist",
代码示例来源:origin: apache/incubator-pinot
responses.add(responseOffline);
ret.add(JsonUtils.objectToJsonNode(responses));
return ret.toString();
} else if (CommonConstants.Helix.TableType.REALTIME == tableType) {
if (helixResourceManager.hasRealtimeTable(tableName)) {
toggleSegmentsForTable(segmentsToToggle, tableNameWithType, segmentName, state, helixResourceManager);
ret.add(JsonUtils.objectToJsonNode(resourceManagerResponse));
return ret.toString();
代码示例来源:origin: HuygensING/timbuctoo
private Map path(ArrayNode path) {
return ImmutableMap.of(
"type", "PATH",
"formatter", ImmutableList.of(),
"subComponents", ImmutableList.of(),
"value", path.toString()
);
}
代码示例来源:origin: stackoverflow.com
String jsonStr = "{\"response\" : [ { \"id\" : \"1a\", \"name\" : \"foo\"},{ \"id\" : \"1b\",\"name\" : \"bar\" } ]}";
ObjectMapper mapper = new ObjectMapper();
JsonNode node = mapper.readTree(jsonStr);
ArrayNode arrayNode = (ArrayNode) node.get("response");
System.out.println(arrayNode);
List<Pojo> pojos = mapper.readValue(arrayNode.toString(), new TypeReference<List<Pojo>>() {});
System.out.println(pojos);
代码示例来源:origin: vivo-project/Vitro
private void addJSONArrayToFormSpecificData(ArrayNode jsonArray, EditConfigurationVTwo editConfig) {
HashMap<String, Object> data = editConfig.getFormSpecificData();
data.put("existingPageContentUnits", jsonArray.toString());
//Experimenting with putting actual array in
data.put("existingPageContentUnitsJSONArray", jsonArray);
}
代码示例来源:origin: yammer/breakerbox
private List<JsonNode> convertJsonArrayToList(ArrayNode arrayNode) {
try {
return mapper.readValue(arrayNode.toString(), TypeFactory.defaultInstance()
.constructCollectionType(List.class, JsonNode.class));
} catch (IOException e) {
LOGGER.error("Failed to convert ArrayNode to List<JsonNode>", e);
return Collections.emptyList();
}
}
}
代码示例来源:origin: stackoverflow.com
ObjectMapper mapper = new ObjectMapper();
JsonNode parsedJson = mapper.readTree(json); //parse the String or do what you already are doing to deserialize the JSON
ArrayNode outerArray = mapper.createArrayNode(); //your outer array
ObjectNode outerObject = mapper.createObjectNode(); //the object with the "data" array
outerObject.putPOJO("data",parsedJson);
outerArray.add(outerObject);
System.out.println(outerArray.toString()); //just to confirm everything is working
代码示例来源:origin: apache/atlas
protected EntityResult updateEntities(ArrayNode entities) throws AtlasServiceException {
LOG.debug("Updating entities: {}", entities);
ObjectNode response = callAPIWithBody(API_V1.UPDATE_ENTITY, entities.toString());
EntityResult results = extractEntityResult(response);
LOG.debug("Update entities returned results: {}", results);
return results;
}
代码示例来源:origin: org.apache.atlas/atlas-client-v1
protected EntityResult updateEntities(ArrayNode entities) throws AtlasServiceException {
LOG.debug("Updating entities: {}", entities);
ObjectNode response = callAPIWithBody(API_V1.UPDATE_ENTITY, entities.toString());
EntityResult results = extractEntityResult(response);
LOG.debug("Update entities returned results: {}", results);
return results;
}
代码示例来源:origin: io.swagger/swagger-parser
private String parameterDefault(ObjectNode node, String type, String location, ParseResult result) {
String key = "default";
if (type != null && type.equals("array")) {
ArrayNode array = getArray(key, node, false, location, result);
return array != null ? array.toString() : null;
}
return getString(key, node, false, location, result);
}
代码示例来源:origin: stackoverflow.com
ArrayNode arrayNode = (ArrayNode) mapper.readTree(this.getScrape().getScrapetext());
A a = mapper.readValue(arrayNode.get(0), A.class);
arrayNode.remove(0);
List<B> b = mapper.readValue(arrayNode.toString(), new TypeReference<List<B>>()
{
});
代码示例来源:origin: org.onosproject/onos-cli
private void json(Set<Driver> drivers) {
ArrayNode result = mapper().createArrayNode();
drivers.forEach(driver -> result.add(jsonForEntity(driver, Driver.class)));
print("%s", result.toString());
}
代码示例来源:origin: embulk/embulk-input-jdbc
@Override
public void jsonColumn(Column column)
{
try {
Value v = jsonParser.parse(buildJsonArray((Object[]) value.getArray()).toString());
to.setJson(column, v);
}
catch (JsonParseException | SQLException | ClassCastException e) {
super.jsonColumn(column);
}
}
代码示例来源:origin: HuygensING/timbuctoo
public void setCommonVreProperties(String vreName) {
final String prefixedName = vreName + "relation";
edge.property("relation_accepted", true);
edge.property(prefixedName + "_accepted", true);
edge.property("types", jsnA(jsn("relation"), jsn(prefixedName)).toString());
}
}
内容来源于网络,如有侵权,请联系作者删除!