本文整理匯總了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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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());
}
示例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;
}
示例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();
}
示例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;
}
示例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();
}
示例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();
}
示例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;
}
示例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);
}
}
示例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);
}
}