本文整理汇总了Java中com.alibaba.fastjson.JSON.DEFAULT_PARSER_FEATURE属性的典型用法代码示例。如果您正苦于以下问题:Java JSON.DEFAULT_PARSER_FEATURE属性的具体用法?Java JSON.DEFAULT_PARSER_FEATURE怎么用?Java JSON.DEFAULT_PARSER_FEATURE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.alibaba.fastjson.JSON
的用法示例。
在下文中一共展示了JSON.DEFAULT_PARSER_FEATURE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test_date_2
public void test_date_2() throws Exception {
int features = JSON.DEFAULT_PARSER_FEATURE;
DefaultJSONParser parser = new DefaultJSONParser("new Date(1294552193254)", ParserConfig.getGlobalInstance(), features);
java.sql.Timestamp date = parser.parseObject(java.sql.Timestamp.class);
Assert.assertEquals(new java.sql.Timestamp(1294552193254L), date);
parser.close();
}
示例2: test_date_1
public void test_date_1() throws Exception {
int features = JSON.DEFAULT_PARSER_FEATURE;
features = Feature.config(features, Feature.AllowISO8601DateFormat, true);
DefaultJSONParser parser = new DefaultJSONParser("\"2011-01-09T13:49:53.254\"", ParserConfig.getGlobalInstance(), features);
java.util.Date date = parser.parseObject(java.util.Date.class);
Assert.assertEquals(new java.util.Date(1294552193254L), date);
parser.close();
}
示例3: test_date_2
public void test_date_2() throws Exception {
int features = JSON.DEFAULT_PARSER_FEATURE;
DefaultJSONParser parser = new DefaultJSONParser("new Date(1294552193254)", ParserConfig.getGlobalInstance(), features);
java.util.Date date = parser.parseObject(java.util.Date.class);
Assert.assertEquals(new java.util.Date(1294552193254L), date);
parser.close();
}
示例4: test_date_6
public void test_date_6() throws Exception {
int features = JSON.DEFAULT_PARSER_FEATURE;
features = Feature.config(features, Feature.AllowISO8601DateFormat, true);
java.util.Date date = JSON.parseObject("{d:\"2011-01-09T13:49:53\"}", Entity.class, Feature.AllowISO8601DateFormat).getD();
Assert.assertEquals(new java.util.Date(1294552193000L), date);
}
示例5: test_url
public void test_url() throws Exception {
UUID id = UUID.randomUUID();
Assert.assertEquals(id, JSON.parseObject("'" + id.toString() + "'", UUID.class));
Assert.assertEquals(null, JSON.parseObject("null", UUID.class));
DefaultJSONParser parser = new DefaultJSONParser("null", ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);
Assert.assertEquals(null, MiscCodec.instance.deserialze(parser, null, null));
Assert.assertEquals(JSONToken.LITERAL_STRING, MiscCodec.instance.getFastMatchToken());
}
示例6: test_string_null
public void test_string_null() throws Exception {
String input = "null";
DefaultJSONParser parser = new DefaultJSONParser(input, ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);
StringCodec deser = new StringCodec();
Assert.assertNull(deser.deserialze(parser, null, null));
}
示例7: test_date_4
public void test_date_4() throws Exception {
int features = JSON.DEFAULT_PARSER_FEATURE;
features = Feature.config(features, Feature.AllowISO8601DateFormat, true);
DefaultJSONParser parser = new DefaultJSONParser("\"2011-01-09\"", ParserConfig.getGlobalInstance(), features);
java.sql.Timestamp date = parser.parseObject(java.sql.Timestamp.class);
Assert.assertEquals(new java.sql.Timestamp(1294502400000L), date);
parser.close();
}
示例8: test_date_1
public void test_date_1() throws Exception {
int features = JSON.DEFAULT_PARSER_FEATURE;
features = Feature.config(features, Feature.AllowISO8601DateFormat, true);
DefaultJSONParser parser = new DefaultJSONParser("\"2011-01-09T13:49:53.254\"", ParserConfig.getGlobalInstance(), features);
java.sql.Timestamp date = parser.parseObject(java.sql.Timestamp.class);
Assert.assertEquals(new java.sql.Timestamp(1294552193254L), date);
parser.close();
}
示例9: test_date_1
public void test_date_1() throws Exception {
int features = JSON.DEFAULT_PARSER_FEATURE;
features = Feature.config(features, Feature.AllowISO8601DateFormat, true);
DefaultJSONParser parser = new DefaultJSONParser("\"2011-01-09T13:49:53.254\"", ParserConfig.getGlobalInstance(), features);
java.sql.Date date = parser.parseObject(java.sql.Date.class);
Assert.assertEquals(new java.sql.Date(1294552193254L), date);
parser.close();
}
示例10: test_date_3
public void test_date_3() throws Exception {
int features = JSON.DEFAULT_PARSER_FEATURE;
features = Feature.config(features, Feature.AllowISO8601DateFormat, true);
DefaultJSONParser parser = new DefaultJSONParser("\"2011-01-09T13:49:53\"", ParserConfig.getGlobalInstance(), features);
java.sql.Date date = parser.parseObject(java.sql.Date.class);
Assert.assertEquals(new java.sql.Date(1294552193000L), date);
parser.close();
}
示例11: test_bigdecimal
public void test_bigdecimal() throws Exception {
Assert.assertEquals(1309861159710L, JSON.parseObject("1309861159710", java.sql.Date.class).getTime());
Assert.assertEquals(1309861159710L, JSON.parseObject("1309861159710.0", java.sql.Date.class).getTime());
Assert.assertEquals(1309861159710L, JSON.parseObject("'1309861159710'", java.sql.Date.class).getTime());
Assert.assertEquals(null, JSON.parseObject("null", Integer.class));
DefaultJSONParser parser = new DefaultJSONParser("null", ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);
Assert.assertEquals(null, SqlDateDeserializer.instance.deserialze(parser, null, null));
Assert.assertEquals(JSONToken.LITERAL_INT, SqlDateDeserializer.instance.getFastMatchToken());
}
示例12: DefaultJSONParser
public DefaultJSONParser(String input){
this(input, ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);
}
示例13: JSONReaderScanner
public JSONReaderScanner(char[] input, int inputLength){
this(input, inputLength, JSON.DEFAULT_PARSER_FEATURE);
}
示例14: DefaultJSONParser
public DefaultJSONParser(String input, ParserConfig config) {
this((Object) input, new JSONScanner(input, JSON.DEFAULT_PARSER_FEATURE), config);
}
示例15: test_char
public void test_char() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("null", ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);
Assert.assertNull(new CharacterCodec().deserialze(parser, null, null));
}