本文整理了Java中org.boon.json.ObjectMapper.parser()
方法的一些代码示例,展示了ObjectMapper.parser()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectMapper.parser()
方法的具体详情如下:
包路径:org.boon.json.ObjectMapper
类名称:ObjectMapper
方法名:parser
暂无
代码示例来源:origin: spring-projects/spring-integration
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public <T> T fromJson(Object json, Map<String, Object> javaTypes) throws Exception {
JsonParserAndMapper parser = this.objectMapper.parser();
代码示例来源:origin: boonproject/boon
public static <T> List<T> fromJsonArray(String str, Class<T> clazz) {
return json.parser().parseList(clazz, str);
}
代码示例来源:origin: boonproject/boon
public static <T> List<T> fromJsonArray(String str, Class<T> clazz) {
return json.parser().parseList(clazz, str);
}
代码示例来源:origin: io.fastjson/boon
public static <T> List<T> fromJsonArray(String str, Class<T> clazz) {
return json.parser().parseList(clazz, str);
}
代码示例来源:origin: boonproject/boon
public static void part8WorkingWithPrimitives() throws Exception {
puts ("\n\n\n\npart8WorkingWithPrimitives");
ObjectMapper mapper = JsonFactory.create();
String intStr = "123456";
int someNumber = mapper.parser().parseInt( intStr );
boolean ok = someNumber == 123456 || die( "" + someNumber );
String jsonArray = "[0,1,2,3,4,5,6,7,8]";
int [] intArray = mapper.parser().parseIntArray( jsonArray );
ok |= Arrays.equals( new int[]{1,2,3,4,5,6,7,8}, intArray );
String jsonMap = "{\"race\":true, \"speedup\": false, \"name\": \"bob\", \"value\": -0}";
Map <String, Object> map = mapper.parser().parseMap( jsonMap );
ok |= ( map.get("race") == Boolean.TRUE && map.get("name").equals( "bob" ) ) || die(map.toString());
ok |= (int)map.get("value") == -0 || die(map.get("value"));
puts("ok?", ok);
}
代码示例来源:origin: org.springframework.integration/spring-integration-core
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public <T> T fromJson(Object json, Map<String, Object> javaTypes) throws Exception {
JsonParserAndMapper parser = this.objectMapper.parser();
代码示例来源:origin: boonproject/boon
private static void part12Gson() {
ObjectMapper gson = JsonFactory.createUseAnnotations( true );
puts ( gson.toJson ( 1 ) );
puts ( gson.toJson ( "abcd" ) );
puts ( gson.toJson ( new Long ( 10 ) ) );
int[] values = { 1 };
puts ( gson.toJson ( values ) );
int ione = gson.fromJson("1", int.class);
Integer oneI = gson.fromJson("1", Integer.class);
Boolean wrapper = gson.fromJson("false", Boolean.class);
String str = gson.fromJson("\"abc\"", String.class);
String anotherStr = (String)gson.fromJson("[\"abc\"]", List.class).get ( 0 );
BagOfPrimitives obj = new BagOfPrimitives();
String json = gson.toJson(obj);
puts (json);
int[] ints = {1, 2, 3, 4, 5};
String[] strings = {"abc", "def", "ghi"};
puts ( gson.toJson ( ints ) ); // ==> prints [1,2,3,4,5]
puts ( gson.toJson ( strings ) ); // ==> prints ["abc", "def", "ghi"]
Collection<Integer> ints2 = Lists.list(1,2,3,4,5);
puts ( gson.toJson(ints) ) ;// ==> json is [1,2,3,4,5]
puts ( gson.parser ().parseList ( Integer.class, "[1,2,3,4,5]" ));
//Serializing and Deserializing Generic Types TODO missing from GSON manual
//Left off here https://sites.google.com/site/gson/gson-user-guide#TOC-Serializing-and-Deserializing-Generic-Types
}
内容来源于网络,如有侵权,请联系作者删除!