本文整理汇总了Java中com.fasterxml.jackson.databind.node.ArrayNode.get方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayNode.get方法的具体用法?Java ArrayNode.get怎么用?Java ArrayNode.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.fasterxml.jackson.databind.node.ArrayNode
的用法示例。
在下文中一共展示了ArrayNode.get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: f_jackson
import com.fasterxml.jackson.databind.node.ArrayNode; //导入方法依赖的package包/类
private void f_jackson() throws Exception {
long startNano = System.nanoTime();
for (int i = 0; i < COUNT; ++i) {
ObjectMapper mapper = new ObjectMapper();
ArrayNode node = (ArrayNode) mapper.readTree(text);
JsonNode head = node.get(0);
JsonNode body = node.get(1);
}
long nano = System.nanoTime() - startNano;
System.out.println(NumberFormat.getInstance().format(nano));
}
示例2: readList
import com.fasterxml.jackson.databind.node.ArrayNode; //导入方法依赖的package包/类
protected Object readList(ListSchema schema, JsonNode node) {
List list = Lists.newArrayList();
ArrayNode arrayNode = (ArrayNode) node;
for (int i = 0; i < arrayNode.size(); i++) {
JsonNode val = arrayNode.get(i);
list.add(getNodeData(schema.getValueSchema(), val));
}
return list;
}
示例3: findFile
import com.fasterxml.jackson.databind.node.ArrayNode; //导入方法依赖的package包/类
private ObjectNode findFile(ObjectNode folderNode, String filename)
{
ArrayNode filesArray = getArray(folderNode, "files");
for( int i = 0; i < filesArray.size(); i++ )
{
ObjectNode file = (ObjectNode) filesArray.get(i);
if( file.get("filename").asText().equals(filename) )
{
return file;
}
}
throw new AssertionError("File " + filename + " not found");
}
示例4: findFolder
import com.fasterxml.jackson.databind.node.ArrayNode; //导入方法依赖的package包/类
private ObjectNode findFolder(ObjectNode folderNode, String filename)
{
ArrayNode filesArray = getArray(folderNode, "folders");
for( int i = 0; i < filesArray.size(); i++ )
{
ObjectNode file = (ObjectNode) filesArray.get(i);
if( file.get("filename").asText().equals(filename) )
{
return file;
}
}
throw new AssertionError("Folder " + filename + " not found");
}
示例5: findFileIndex
import com.fasterxml.jackson.databind.node.ArrayNode; //导入方法依赖的package包/类
private int findFileIndex(ObjectNode staging, String filename)
{
ArrayNode filesArray = (ArrayNode) staging.get("files");
for( int i = 0; i < filesArray.size(); i++ )
{
ObjectNode file = (ObjectNode) filesArray.get(i);
if( file.get("name").asText().equals(filename) )
{
return i;
}
}
return -1;
}
示例6: findFile
import com.fasterxml.jackson.databind.node.ArrayNode; //导入方法依赖的package包/类
private ObjectNode findFile(ObjectNode staging, String filename)
{
ArrayNode filesArray = (ArrayNode) staging.get("files");
for( int i = 0; i < filesArray.size(); i++ )
{
ObjectNode file = (ObjectNode) filesArray.get(i);
if( file.get("name").asText().equals(filename) )
{
return file;
}
}
throw new AssertionError("File " + filename + " not found");
}
示例7: extractUserProfile
import com.fasterxml.jackson.databind.node.ArrayNode; //导入方法依赖的package包/类
@Override
protected VkProfile extractUserProfile(final String body) throws HttpAction {
final VkProfile profile = new VkProfile();
JsonNode json = JsonHelper.getFirstNode(body);
if (json != null) {
ArrayNode array = (ArrayNode) json.get("response");
JsonNode userNode = array.get(0);
profile.setId(JsonHelper.getElement(userNode, "uid"));
for (final String attribute : profile.getAttributesDefinition().getPrimaryAttributes()) {
profile.addAttribute(attribute, JsonHelper.getElement(userNode, attribute));
}
}
return profile;
}