当前位置: 首页>>代码示例>>Java>>正文


Java JsonNode.get方法代码示例

本文整理汇总了Java中org.codehaus.jackson.JsonNode.get方法的典型用法代码示例。如果您正苦于以下问题:Java JsonNode.get方法的具体用法?Java JsonNode.get怎么用?Java JsonNode.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.codehaus.jackson.JsonNode的用法示例。


在下文中一共展示了JsonNode.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findBy

import org.codehaus.jackson.JsonNode; //导入方法依赖的package包/类
private List<JsonNode> findBy(String key, String value, boolean onlyReturnFirstMatch, boolean arrayContainingMatch) {
    Iterator<JsonNode> nodes = root.get("data").getElements();
    List<JsonNode> results = new LinkedList<>();
    while(nodes.hasNext()) {
        JsonNode node = nodes.next();
        if ((null != node.get(key)) && (node.get(key).isValueNode())) {
            final String valueNode = node.get(key).getTextValue();
            if (arrayContainingMatch) {
                if (splitPseudoJsonValueArray(valueNode).contains(value)) {
                    results.add(node);
                }
            } else {
                if (valueNode.equals(value)) {
                    results.add(node);
                }
            }
        }
    }
    return results;
}
 
开发者ID:apache,项目名称:sling-org-apache-sling-testing-clients,代码行数:21,代码来源:ServicesInfo.java

示例2: deserialize

import org.codehaus.jackson.JsonNode; //导入方法依赖的package包/类
@Override
public JsonCreateWebServer deserialize(final JsonParser jp, final DeserializationContext ctxt)
        throws IOException {

    final ObjectCodec obj = jp.getCodec();
    final JsonNode node = obj.readTree(jp).get(0);

    final JsonNode apacheHttpdMediaId = node.get("apacheHttpdMediaId");
    final JsonCreateWebServer jcws = new JsonCreateWebServer(node.get("webserverName").getTextValue(),
            node.get("hostName").getTextValue(),
            node.get("portNumber").asText(),
            node.get("httpsPort").asText(),
               deserializeGroupIdentifiers(node),
            node.get("statusPath").getTextValue(),
            apacheHttpdMediaId == null ? null : apacheHttpdMediaId.asText());
    return jcws;
}
 
开发者ID:cerner,项目名称:jwala,代码行数:18,代码来源:JsonCreateWebServer.java

示例3: parseLines

import org.codehaus.jackson.JsonNode; //导入方法依赖的package包/类
private List<Line> parseLines(JsonNode node){
	JsonNode lineNodes=node.get("lines");
	if(lineNodes==null){
		return null;
	}
	List<Line> lines=new ArrayList<Line>();
	Iterator<JsonNode> iter=lineNodes.iterator();
	while(iter.hasNext()){
		JsonNode jsonNode=iter.next();
		Line line=new Line();
		line.setFromNodeId(jsonNode.get("fromNodeId").getIntValue());
		line.setToNodeId(jsonNode.get("toNodeId").getIntValue());
		lines.add(line);
	}
	return lines;
}
 
开发者ID:youseries,项目名称:urule,代码行数:17,代码来源:ReteNodeJsonDeserializer.java

示例4: buildScoreRule

import org.codehaus.jackson.JsonNode; //导入方法依赖的package包/类
private void buildScoreRule(JsonParser jsonParser,JsonNode ruleNode,ScoreRule rule){
	rule.setScoringBean(JsonUtils.getJsonValue(ruleNode, "scoringBean"));
	AssignTargetType assignTargetType=AssignTargetType.valueOf(JsonUtils.getJsonValue(ruleNode, "assignTargetType"));
	rule.setAssignTargetType(assignTargetType);
	rule.setVariableCategory(JsonUtils.getJsonValue(ruleNode, "variableCategory"));
	rule.setVariableName(JsonUtils.getJsonValue(ruleNode, "variableName"));
	rule.setVariableLabel(JsonUtils.getJsonValue(ruleNode, "variableLabel"));
	String datatypeStr=JsonUtils.getJsonValue(ruleNode, "datatype");
	if(StringUtils.isNotBlank(datatypeStr)){
		rule.setDatatype(Datatype.valueOf(datatypeStr));
	}
	try{
		JsonNode knowledgePackageWrapperNode=ruleNode.get("knowledgePackageWrapper");
		ObjectMapper mapper = (ObjectMapper)jsonParser.getCodec();
		KnowledgePackageWrapper wrapper=mapper.readValue(knowledgePackageWrapperNode, KnowledgePackageWrapper.class);
		wrapper.buildDeserialize();
		rule.setKnowledgePackageWrapper(wrapper);			
	}catch(Exception ex){
		throw new RuleException(ex);
	}
	
}
 
开发者ID:youseries,项目名称:urule,代码行数:23,代码来源:AbstractJsonDeserializer.java

示例5: parseJson

import org.codehaus.jackson.JsonNode; //导入方法依赖的package包/类
/**
 *  Parse the json of flow_data field from execution_flows. Use recursion to handle the nested case.
 * @param flowJson
 * @param flowExecId
 * @return
 * @throws IOException
 */
public List<AzkabanJobExecRecord> parseJson(String flowJson, long flowExecId)
  throws IOException {

  ObjectMapper mapper = new ObjectMapper();
  JsonNode wholeFlow = mapper.readTree(flowJson);
  JsonNode allJobs = wholeFlow.get("nodes");
  String flowPath = wholeFlow.get("projectName").asText() + ":" + wholeFlow.get("flowId").asText();
  List<AzkabanJobExecRecord> results = parseJsonHelper(allJobs, flowExecId, flowPath);
  AzkabanJobExecUtil.sortAndSet(results);
  return results;
}
 
开发者ID:thomas-young-2013,项目名称:wherehowsX,代码行数:19,代码来源:AzJobChecker.java

示例6: findBy

import org.codehaus.jackson.JsonNode; //导入方法依赖的package包/类
private JsonNode findBy(String key, String value) {
    Iterator<JsonNode> nodes = root.get("data").getElements();
    while(nodes.hasNext()) {
        JsonNode node = nodes.next();
        if ((null != node.get(key)) && (node.get(key).isValueNode())) {
            final String valueNode = node.get(key).getTextValue();
            if (valueNode.equals(value)) {
                return node;
            }
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:sling-org-apache-sling-testing-clients,代码行数:14,代码来源:BundlesInfo.java

示例7: deserialize

import org.codehaus.jackson.JsonNode; //导入方法依赖的package包/类
@Override
public JsonControlWebServer deserialize(final JsonParser jp,
                                  final DeserializationContext ctxt) throws IOException {

    final ObjectCodec obj = jp.getCodec();
    final JsonNode rootNode = obj.readTree(jp);
    final JsonNode operation = rootNode.get("controlOperation");

    return new JsonControlWebServer(operation.getTextValue());
}
 
开发者ID:cerner,项目名称:jwala,代码行数:11,代码来源:JsonControlWebServer.java

示例8: parseComplexArithmetic

import org.codehaus.jackson.JsonNode; //导入方法依赖的package包/类
public static ComplexArithmetic parseComplexArithmetic(JsonNode node){
	JsonNode arithmeticNode=node.get("arithmetic");
	if(arithmeticNode==null){
		return null;
	}
	ComplexArithmetic arith=new ComplexArithmetic();
	arith.setType(ArithmeticType.valueOf(getJsonValue(arithmeticNode, "type")));
	arith.setValue(parseValue(arithmeticNode));
	return arith;
}
 
开发者ID:youseries,项目名称:urule,代码行数:11,代码来源:JsonUtils.java

示例9: getBundleVersion

import org.codehaus.jackson.JsonNode; //导入方法依赖的package包/类
/**
 * Get the version of the bundle
 * @param symbolicName bundle symbolic name
 * @return bundle version
 * @throws ClientException if the version is not retrieved
 */
public String getBundleVersion(String symbolicName) throws ClientException {
    final JsonNode bundle = getBundleData(symbolicName);
    final JsonNode versionNode = bundle.get(JSON_KEY_VERSION);

    if (versionNode == null) {
        throw new ClientException("Cannot get version from bundle json");
    }

    return versionNode.getTextValue();
}
 
开发者ID:apache,项目名称:sling-org-apache-sling-testing-clients,代码行数:17,代码来源:OsgiConsoleClient.java

示例10: parseNamedCriteria

import org.codehaus.jackson.JsonNode; //导入方法依赖的package包/类
private NamedCriteria parseNamedCriteria(JsonNode jsonNode){
	NamedCriteria criteria=new NamedCriteria();
	criteria.setReferenceName(jsonNode.get("referenceName").getTextValue());
	criteria.setVariableCategory(jsonNode.get("variableCategory").getTextValue());
	JsonNode unitNode=jsonNode.get("unit");
	if(unitNode!=null){
		CriteriaUnit unit = parseCriteriaUnit(unitNode);
		criteria.setUnit(unit);
	}
	return criteria;
}
 
开发者ID:youseries,项目名称:urule,代码行数:12,代码来源:ReteNodeJsonDeserializer.java

示例11: getBundleState

import org.codehaus.jackson.JsonNode; //导入方法依赖的package包/类
/**
 * Get the state of the bundle
 * @param symbolicName bundle symbolic name
 * @return the state of the bundle
 * @throws ClientException if the state cannot be retrieved
 */
public String getBundleState(String symbolicName) throws ClientException {
    final JsonNode bundle = getBundleData(symbolicName);
    final JsonNode stateNode = bundle.get(JSON_KEY_STATE);

    if (stateNode == null) {
        throw new ClientException("Cannot get state from bundle json");
    }

    return stateNode.getTextValue();
}
 
开发者ID:apache,项目名称:sling-org-apache-sling-testing-clients,代码行数:17,代码来源:OsgiConsoleClient.java

示例12: getBundleId

import org.codehaus.jackson.JsonNode; //导入方法依赖的package包/类
/**
 * Get the id of the bundle
 * @param symbolicName bundle symbolic name
 * @return the id
 * @throws ClientException if the id cannot be retrieved
 */
public long getBundleId(String symbolicName) throws ClientException {
    final JsonNode bundle = getBundleData(symbolicName);
    final JsonNode idNode = bundle.get(JSON_KEY_ID);

    if (idNode == null) {
        throw new ClientException("Cannot get id from bundle json");
    }

    return idNode.getLongValue();
}
 
开发者ID:apache,项目名称:sling-org-apache-sling-testing-clients,代码行数:17,代码来源:OsgiConsoleClient.java

示例13: getBundleData

import org.codehaus.jackson.JsonNode; //导入方法依赖的package包/类
/**
 * Returns a data structure like:
 *
 * {
 *   "status" : "Bundle information: 173 bundles in total - all 173 bundles active.",
 *   "s" : [173,171,2,0,0],
 *   "data": [{
 *     "id":0,
 *     "name":"System Bundle",
 *     "fragment":false,
 *     "stateRaw":32,
 *     "state":"Active",
 *     "version":"3.0.7",
 *     "symbolicName":"org.apache.felix.framework",
 *     "category":""
 *   }]
 * }
 */
private JsonNode getBundleData(String symbolicName) throws ClientException {
    final String path = getBundlePath(symbolicName, ".json");
    final String content = this.doGet(path, SC_OK).getContent();
    final JsonNode root = JsonUtils.getJsonNodeFromString(content);

    if (root.get(JSON_KEY_DATA) == null) {
        throw new ClientException(path + " does not provide '" + JSON_KEY_DATA + "' element, JSON content=" + content);
    }

    Iterator<JsonNode> data = root.get(JSON_KEY_DATA).getElements();
    if (!data.hasNext()) {
        throw new ClientException(path + "." + JSON_KEY_DATA + " is empty, JSON content=" + content);
    }

    final JsonNode bundle = data.next();
    if (bundle.get(JSON_KEY_STATE) == null) {
        throw new ClientException(path + ".data[0].state missing, JSON content=" + content);
    }

    return bundle;
}
 
开发者ID:apache,项目名称:sling-org-apache-sling-testing-clients,代码行数:40,代码来源:OsgiConsoleClient.java

示例14: ComponentInfo

import org.codehaus.jackson.JsonNode; //导入方法依赖的package包/类
public ComponentInfo(JsonNode root) throws ClientException {
    if(root.get("id") != null) {
        if(root.get("id") == null) {
            throw new ClientException("No Component Info returned");
        }
        component = root;
    } else {
        if(root.get("data") == null && root.get("data").size() < 1) {
            throw new ClientException("No Component Info returned");
        }
        component = root.get("data").get(0);
    }
}
 
开发者ID:apache,项目名称:sling-org-apache-sling-testing-clients,代码行数:14,代码来源:ComponentInfo.java

示例15: BundleInfo

import org.codehaus.jackson.JsonNode; //导入方法依赖的package包/类
public BundleInfo(JsonNode root) throws ClientException {
    if(root.get("id") != null) {
        if(root.get("id") == null) {
            throw new ClientException("No Bundle Info returned");
        }
        bundle = root;
    } else {
        if(root.get("data") == null && root.get("data").size() < 1) {
            throw new ClientException("No Bundle Info returned");
        }
        bundle = root.get("data").get(0);
    }
}
 
开发者ID:apache,项目名称:sling-org-apache-sling-testing-clients,代码行数:14,代码来源:BundleInfo.java


注:本文中的org.codehaus.jackson.JsonNode.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。