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


Java JsonNode.getTextValue方法代码示例

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


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

示例1: getTrackIdAsString

import org.codehaus.jackson.JsonNode; //导入方法依赖的package包/类
private String getTrackIdAsString(JsonNode trackIDNode)
{
	String output = null;
	if (trackIDNode.isTextual())
		output = trackIDNode.getTextValue();
	else if (trackIDNode.isInt())
		output = Integer.toString(trackIDNode.getIntValue());
	else if (trackIDNode.isLong())
		output = Long.toString(trackIDNode.getLongValue());
	else if (trackIDNode.isDouble())
		output = Double.toString(trackIDNode.getDoubleValue());
	else if (trackIDNode.isFloatingPointNumber())
		output = trackIDNode.getDecimalValue().toString();

	if (!Validator.isEmpty(output))
	{
		output = output.replace("'", "''");
	}
	return output;
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:21,代码来源:MLOBIOutboundTransport.java

示例2: testNestedException

import org.codehaus.jackson.JsonNode; //导入方法依赖的package包/类
@Test
public void testNestedException() throws Throwable {
  Exception e =
      new NoRouteToHostException("that box caught fire 3 years ago");
  Exception ioe = new IOException("Datacenter problems", e);
  ThrowableInformation ti = new ThrowableInformation(ioe);
  Log4Json l4j = new Log4Json();
  long timeStamp = Time.now();
  String outcome = l4j.toJson(new StringWriter(),
      "testNestedException",
      timeStamp,
      "INFO",
      "quoted\"",
      "new line\n and {}",
      ti)
      .toString();
  println("testNestedException", outcome);
  ContainerNode rootNode = Log4Json.parse(outcome);
  assertEntryEquals(rootNode, Log4Json.LEVEL, "INFO");
  assertEntryEquals(rootNode, Log4Json.NAME, "testNestedException");
  assertEntryEquals(rootNode, Log4Json.TIME, timeStamp);
  assertEntryEquals(rootNode, Log4Json.EXCEPTION_CLASS,
      ioe.getClass().getName());
  JsonNode node = assertNodeContains(rootNode, Log4Json.STACK);
  assertTrue("Not an array: " + node, node.isArray());
  node = assertNodeContains(rootNode, Log4Json.DATE);
  assertTrue("Not a string: " + node, node.isTextual());
  //rather than try and make assertions about the format of the text
  //message equalling another ISO date, this test asserts that the hypen
  //and colon characters are in the string.
  String dateText = node.getTextValue();
  assertTrue("No '-' in " + dateText, dateText.contains("-"));
  assertTrue("No '-' in " + dateText, dateText.contains(":"));

}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:36,代码来源:TestLog4Json.java

示例3: makeRequest

import org.codehaus.jackson.JsonNode; //导入方法依赖的package包/类
private String makeRequest(String endpoint, String uri, String requestType) {
    try {
        HttpPost httpPost = new HttpPost(endpoint);
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("url", uri));

        UrlEncodedFormEntity entity = new UrlEncodedFormEntity(params, Consts.UTF_8);
        httpPost.setEntity(entity);
        HttpResponse response = client.execute(httpPost);

        String result = null;
        String entities = EntityUtils.toString(response.getEntity());
        JsonNode rootNode = new ObjectMapper().readTree(entities).get(requestType);

        switch (requestType) {
            case "similarEntities":
            case "relatedEntities":
                int count = 0;
                result = "";
                for (JsonNode node : rootNode) {
                    count++;
                    if (count <= ResponseData.MAX_DATA_SIZE) {
                        result += "<" + node.get("url").getTextValue() + "> ";
                    }
                    else {
                        break;
                    }
                }
                break;
            case "summary":
                result = rootNode.getTextValue();
                break;
        }
        return result.trim();
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
 
开发者ID:dbpedia,项目名称:chatbot,代码行数:41,代码来源:GenesisService.java

示例4: 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

示例5: 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

示例6: deserialize

import org.codehaus.jackson.JsonNode; //导入方法依赖的package包/类
@Override
public JsonControlJvm 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 JsonControlJvm(operation.getTextValue());
}
 
开发者ID:cerner,项目名称:jwala,代码行数:11,代码来源:JsonControlJvm.java

示例7: deserialize

import org.codehaus.jackson.JsonNode; //导入方法依赖的package包/类
@Override
public JsonControlGroup 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 JsonControlGroup(operation.getTextValue());
}
 
开发者ID:cerner,项目名称:jwala,代码行数:11,代码来源:JsonControlGroup.java

示例8: 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


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