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


Java JSONPath.compile方法代码示例

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


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

示例1: test_path_size_1

import com.alibaba.fastjson.JSONPath; //导入方法依赖的package包/类
public void test_path_size_1() throws Exception {
    List list = new ArrayList();
    list.add(new Entity(101, "kiki"));
    list.add(new Entity(102, "ljw2083"));
    list.add(new Entity(103, "ljw2083"));

    JSONPath path = JSONPath.compile("$");

    Assert.assertEquals(3, path.size(list));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:JSONPath_size.java

示例2: test_path_size_2

import com.alibaba.fastjson.JSONPath; //导入方法依赖的package包/类
public void test_path_size_2() throws Exception {
    List list = new ArrayList();
    list.add(new Entity(101, "kiki"));
    list.add(new Entity(102, "ljw2083"));
    list.add(new Entity(103, "ljw2083"));

    JSONObject root = new JSONObject();
    root.put("values", list);

    JSONPath path = JSONPath.compile("$.values");

    Assert.assertEquals(3, path.size(root));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:JSONPath_size.java

示例3: test_path_empty

import com.alibaba.fastjson.JSONPath; //导入方法依赖的package包/类
public void test_path_empty() throws Exception {
    Throwable error = null;
    try {
        JSONPath.compile("");
    } catch (JSONPathException ex) {
        error = ex;
    }
    Assert.assertNotNull(error);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:JSONPath_1.java

示例4: test_path_null

import com.alibaba.fastjson.JSONPath; //导入方法依赖的package包/类
public void test_path_null() throws Exception {
    Throwable error = null;
    try {
        JSONPath.compile(null);
    } catch (JSONPathException ex) {
        error = ex;
    }
    Assert.assertNotNull(error);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:JSONPath_1.java

示例5: test_path_size

import com.alibaba.fastjson.JSONPath; //导入方法依赖的package包/类
public void test_path_size() throws Exception {
    JSONPath path = JSONPath.compile("$");

    Assert.assertEquals(-1, path.size(null));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:JSONPath_size.java

示例6: test_jsonpath

import com.alibaba.fastjson.JSONPath; //导入方法依赖的package包/类
public void test_jsonpath() throws Exception {
    Model model = new Model();
    JSONPath path = JSONPath.compile("/value/id");
    path.set(model, 123);
    assertNotNull(model.value);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:AlipayJSONPathReplace.java


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