• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java JsonParserFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.boon.json.JsonParserFactory的典型用法代码示例。如果您正苦于以下问题:Java JsonParserFactory类的具体用法?Java JsonParserFactory怎么用?Java JsonParserFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: JsonBoon

import org.boon.json.JsonParserFactory; //导入依赖的package包/类
public JsonBoon() {
	JsonParserFactory jsonParserFactory = new JsonParserFactory();
	jsonParserFactory.lax();

	// Include nulls and empty fields
	JsonSerializerFactory serializerFactory = new JsonSerializerFactory();
	serializerFactory.setIncludeNulls(true);
	serializerFactory.setIncludeEmpty(true);

	// Install MongoDB / BSON serializers
	tryToAddSerializers("io.datatree.dom.adapters.JsonBoonBsonSerializers", serializerFactory);

	// Format dates
	serializerFactory.setJsonFormatForDates(Config.USE_TIMESTAMPS);

	mapper = JsonFactory.create(jsonParserFactory, serializerFactory);
}
 
开发者ID:berkesa,项目名称:datatree-adapters,代码行数:18,代码来源:JsonBoon.java


示例2: createJsonParserFactory

import org.boon.json.JsonParserFactory; //导入依赖的package包/类
public static JsonParserFactory createJsonParserFactory(final String charset, final boolean lax, final boolean chop, final boolean lazyChop,
        final String fieldAccessType, final boolean useAnnotations) {
    final JsonParserFactory jsonParserFactory = new JsonParserFactory();
    jsonParserFactory.setCharset(Charset.forName(charset));
    jsonParserFactory.setLazyChop(lazyChop);
    jsonParserFactory.setChop(chop);
    jsonParserFactory.setUseAnnotations(useAnnotations);
    if (lax) {
        jsonParserFactory.lax();
    }
    if (FieldAccessMode.FIELD.name().equals(fieldAccessType)) {
        jsonParserFactory.useFieldsOnly();
    } else if (FieldAccessMode.PROPERTY.name().equals(fieldAccessType)) {
        jsonParserFactory.usePropertyOnly();
    } else if (FieldAccessMode.FIELD_THEN_PROPERTY.name().equals(fieldAccessType)) {
        jsonParserFactory.isUseFieldsFirst();
    } else if (FieldAccessMode.PROPERTY_THEN_FIELD.name().equals(fieldAccessType)) {
        jsonParserFactory.usePropertyOnly();
    }
    return jsonParserFactory;
}
 
开发者ID:rmannibucau,项目名称:boon-jaxrs-provider,代码行数:22,代码来源:Boons.java


示例3: jsonPath

import org.boon.json.JsonParserFactory; //导入依赖的package包/类
@Test
public void jsonPath() throws Exception {
	String json = "{\"clazzName\":\"SqlGroup\",\"fieldMap\":{\"String\":\"name\",\"List<SqlItem>\":\"items\"}}";
	Object jsonObject = new JsonParserFactory().create().parse(json);
	assertEquals("SqlGroup", atIndex(jsonObject, "clazzName"));
	System.out.println(atIndex(jsonObject, "fieldMap").getClass());
	assertEquals("{List<SqlItem>=items, String=name}", stringAtIndex(jsonObject, "fieldMap"));
	// GOOD
	Object fromJson = Boon.fromJson(json);
	System.out.println(atIndex(fromJson, "fieldMap.String"));
}
 
开发者ID:East196,项目名称:maker,代码行数:12,代码来源:BoonTest0.java


示例4: factory

import org.boon.json.JsonParserFactory; //导入依赖的package包/类
private JsonParserFactory factory() {
    JsonParserFactory value = factory.get();
    if (value == null) {
        synchronized (factory) {
            value = factory.get();
            if (value == null) {
                value = Boons.createJsonParserFactory(charset, lax, chop, lazyChop, fieldAccessType, useAnnotations);
                factory.set(value);
            }
        }
    }
    return value;
}
 
开发者ID:rmannibucau,项目名称:boon-jaxrs-provider,代码行数:14,代码来源:BoonJsonMessageBodyReader.java


示例5: init

import org.boon.json.JsonParserFactory; //导入依赖的package包/类
protected void init(final JsonParserFactory factory) {
    if (factory != null) {
        this.factory.set(factory);
    } else {
        factory(); // force init
    }
}
 
开发者ID:rmannibucau,项目名称:boon-jaxrs-provider,代码行数:8,代码来源:BoonJsonMessageBodyReader.java


示例6: prepare

import org.boon.json.JsonParserFactory; //导入依赖的package包/类
@Setup
public void prepare() {
	JsonParserFactory factory = new JsonParserFactory();
	this.parser = factory.createFastParser();
}
 
开发者ID:taichi,项目名称:json-benchmarks,代码行数:6,代码来源:BoonBenchmark.java


示例7: test

import org.boon.json.JsonParserFactory; //导入依赖的package包/类
@Test
public void test() {
  
  final JsonParser parser = new JsonParserFactory().create ();
  
  JsonParserAndMapper json = new JsonParserFactory().create();

  String jsonString = "{\"length\":\"100\", \"height\":200}";

  Map object = json.parse(Map.class, jsonString);
  
  //Object object = parser.parse(json);
  
  Map<String, Object> map = EJson.parseObject(jsonString);
  System.out.println(map);
  
  String mapAsJson = EJson.write(map);
  System.out.println(mapAsJson);
  
}
 
开发者ID:ebean-orm-examples,项目名称:avaje-ebeanorm-examples,代码行数:21,代码来源:PlainJsonParseTest.java


示例8: main

import org.boon.json.JsonParserFactory; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static void main (String... args) {
       String path = "json/teams.json";
       puts ("PATH", path);
       puts ("CONTENTS of PATH", IO.read("json/teams.json"));

       /* Using Boon style parser (fast). */
       JsonParserAndMapper boonMapper = new JsonParserFactory().create();
       Object jsonObject = boonMapper.parseFile(path);


       /* Using Boon path. */
       puts ("teamInfo", atIndex(jsonObject, "teamInfo"));
       puts("Team Roster", atIndex(jsonObject, "teamInfo.teamRoster"));
       puts("Team Names", atIndex(jsonObject, "teamInfo.teamRoster.teamNames"));



       /* Using Boon style (easy) 2 parser. */
       jsonObject = Boon.jsonResource(path);


       /* Using Boon path. */
       puts ("teamInfo", atIndex(jsonObject, "teamInfo"));
       puts("Team Roster", atIndex(jsonObject, "teamInfo.teamRoster"));
       puts("Team Names", atIndex(jsonObject, "teamInfo.teamRoster.teamNames"));

       //There is also a Groovy style and a GSON style.

       List<String> teamNames = (List<String>) atIndex(jsonObject, "teamInfo.teamRoster.teamNames");

       puts("Team Names", teamNames);

       Set<String> teamNameSet = set(teamNames);

       puts ("Converted to a set", teamNameSet);

       TeamInfo teamInfo = fromMap((Map<String, Object>) atIndex(jsonObject, "teamInfo"), TeamInfo.class);
       puts(teamInfo);


       TeamRoster teamRoster = fromMap((Map<String, Object>) atIndex(jsonObject, "teamInfo.teamRoster"), TeamRoster.class);
       puts(teamRoster);

   }
 
开发者ID:East196,项目名称:maker,代码行数:46,代码来源:PartialDataTreeExample.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AuthScheme类代码示例发布时间:2022-05-22
下一篇:
Java IStructureComparator类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap