本文整理汇总了Java中org.codehaus.jackson.node.JsonNodeFactory.arrayNode方法的典型用法代码示例。如果您正苦于以下问题:Java JsonNodeFactory.arrayNode方法的具体用法?Java JsonNodeFactory.arrayNode怎么用?Java JsonNodeFactory.arrayNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.codehaus.jackson.node.JsonNodeFactory
的用法示例。
在下文中一共展示了JsonNodeFactory.arrayNode方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createEntitySearchJSONResult
import org.codehaus.jackson.node.JsonNodeFactory; //导入方法依赖的package包/类
/**
* Creates an array of JSON objects which hold details about the found users or groups.
*
* @param list
* the search result to process
* @param addSummary
* if true a summary JSON object will be added to the top of the array. The JSON
* object will be created with {@link #createSearchSummaryStatement(PageableList)} .
* @param imageSize
* the size of the user logo to include in the image path, can be null to not include
* the image path into the JSON object. For groups no image will be included.
* @return the JSON array with the details about the users
*/
public static ArrayNode createEntitySearchJSONResult(
PageableList<CommunoteEntityData> list, boolean addSummary,
ImageSizeType imageSize) {
JsonNodeFactory nodeFactory = JsonHelper.getSharedObjectMapper()
.getNodeFactory();
ArrayNode result = nodeFactory.arrayNode();
if (addSummary) {
result.add(UserSearchHelper.createSearchSummaryStatement(list));
}
for (CommunoteEntityData item : list) {
String imagePath = null;
boolean isGroup = (item instanceof EntityGroupListItem);
if (!isGroup && imageSize != null) {
imagePath = ImageUrlHelper.buildUserImageUrl(item.getEntityId(), imageSize);
}
ObjectNode entry = createUserSearchJSONResult(item.getEntityId(),
item.getShortDisplayName(), item.getDisplayName(),
imagePath, item.getAlias());
entry.put("isGroup", isGroup);
result.add(entry);
}
return result;
}
示例2: createOverrideStrategyField
import org.codehaus.jackson.node.JsonNodeFactory; //导入方法依赖的package包/类
/**
* Creates the override strategy field.
*
* @return the field
*/
private Field createOverrideStrategyField() {
List<String> overrideStrategySymbols = Arrays.asList(OverrideStrategy.APPEND.name(),
OverrideStrategy.REPLACE.name());
Schema overrideStrategyEnum = Schema.createEnum(OVERRIDE_STRATEGY_TYPE_NAME, null,
BASE_SCHEMA_FORM_NAMESPACE, overrideStrategySymbols);
Field overrideStrategyField = new Field(OVERRIDE_STRATEGY, Schema.createUnion(Arrays.asList(
overrideStrategyEnum, Schema.create(Type.NULL))), null, null);
overrideStrategyField.addProp(DISPLAY_NAME, "Override strategy");
JsonNodeFactory jsonFactory = JsonNodeFactory.instance;
ArrayNode displayNamesNode = jsonFactory.arrayNode();
displayNamesNode.add(TextNode.valueOf("Append"));
displayNamesNode.add(TextNode.valueOf("Replace"));
overrideStrategyField.addProp(DISPLAY_NAMES, displayNamesNode);
overrideStrategyField.addProp(DISPLAY_PROMPT, "Select array override strategy");
return overrideStrategyField;
}
示例3: createClassTypeField
import org.codehaus.jackson.node.JsonNodeFactory; //导入方法依赖的package包/类
/**
* Creates the class type field.
*
* @return the field
*/
private Field createClassTypeField() {
List<String> classTypeSymbols = Arrays.asList(OBJECT, EVENT);
Schema classTypeEnum = Schema.createEnum(CLASS_TYPE_TYPE_NAME, null,
BASE_SCHEMA_FORM_NAMESPACE, classTypeSymbols);
Field classTypeField = new Field(CLASS_TYPE, classTypeEnum, null, null);
classTypeField.addProp(DISPLAY_NAME, "Class type");
JsonNodeFactory jsonFactory = JsonNodeFactory.instance;
ArrayNode displayNamesNode = jsonFactory.arrayNode();
displayNamesNode.add(TextNode.valueOf("Object"));
displayNamesNode.add(TextNode.valueOf("Event"));
classTypeField.addProp(DISPLAY_NAMES, displayNamesNode);
classTypeField.addProp(DISPLAY_PROMPT, "Select class type");
classTypeField.addProp(BY_DEFAULT, OBJECT);
return classTypeField;
}
示例4: getParameterList
import org.codehaus.jackson.node.JsonNodeFactory; //导入方法依赖的package包/类
public static String getParameterList(String sessionId, String appId, String repId, String repUpId) throws IOException {
//
if (sessionId == null || sessionId.isEmpty())
throw new IllegalArgumentException("Session Id is empty. Please login.");
HttpPost postRequest = new HttpPost("https://wspublisherv2https.skygiraffe.com/WSPublisherV2.svc/GetReport_ParametersMainScreen4");
// add header
postRequest.setHeader("Content-Type", "application/json");
JsonNodeFactory f = JsonNodeFactory.instance;
ObjectNode o = f.objectNode();
o.put("ApplicationID", appId);
o.put("ReportID", repId);
o.put("TabID","");
ArrayNode diuId = f.arrayNode();
diuId = o.putArray("DataItemUpdateIDs");
o.put("ReportUpdateID",repUpId);
o.put("RequestID",sessionId);
o.put("SessionID",sessionId);
StringEntity inputApps = new StringEntity(o.toString());
inputApps.setContentType("application/json");
postRequest.setEntity(inputApps);
CloseableHttpResponse responseParams = getHttpClient().execute(postRequest);
String paramStr = "";
try {
HttpEntity entityApps = responseParams.getEntity();
paramStr = EntityUtils.toString(entityApps, "UTF-8");
EntityUtils.consume(entityApps);
}finally{
responseParams.close();
}
logger.debug("Params = "+paramStr);
return paramStr;
}
示例5: createBytesJsonValue
import org.codehaus.jackson.node.JsonNodeFactory; //导入方法依赖的package包/类
/**
* Creates the bytes json value.
*
* @param value the value
* @return the array node
* @throws ParseException the parse exception
*/
private static ArrayNode createBytesJsonValue(String value) throws ParseException {
if (value != null) {
JsonNodeFactory jsonFactory = JsonNodeFactory.instance;
ArrayNode bytesNode = jsonFactory.arrayNode();
byte[] data = Base64Utils.fromBase64(value);
for (int i=0;i<data.length;i++) {
bytesNode.add(data[i]);
}
return bytesNode;
} else {
return null;
}
}