本文整理汇总了Java中com.alibaba.fastjson.parser.deserializer.NumberDeserializer类的典型用法代码示例。如果您正苦于以下问题:Java NumberDeserializer类的具体用法?Java NumberDeserializer怎么用?Java NumberDeserializer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NumberDeserializer类属于com.alibaba.fastjson.parser.deserializer包,在下文中一共展示了NumberDeserializer类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test_bigdecimal
import com.alibaba.fastjson.parser.deserializer.NumberDeserializer; //导入依赖的package包/类
public void test_bigdecimal() throws Exception {
Assert.assertEquals(0, JSON.parseObject("0", Double.class).intValue());
Assert.assertEquals(0, JSON.parseObject("0.0", Double.class).intValue());
Assert.assertEquals(0, JSON.parseObject("'0'", Double.class).intValue());
Assert.assertEquals(0, JSON.parseObject("'0'", double.class).intValue());
Assert.assertEquals(null, JSON.parseObject("null", Double.class));
DefaultJSONParser parser = new DefaultJSONParser("null", ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);
Assert.assertEquals(null, NumberDeserializer.instance.deserialze(parser, null, null));
Assert.assertEquals(JSONToken.LITERAL_INT, NumberDeserializer.instance.getFastMatchToken());
}
示例2: test_match
import com.alibaba.fastjson.parser.deserializer.NumberDeserializer; //导入依赖的package包/类
public void test_match() throws Exception {
Assert.assertEquals(JSONToken.LBRACKET, AtomicCodec.instance.getFastMatchToken());
Assert.assertEquals(JSONToken.LITERAL_STRING, MiscCodec.instance.getFastMatchToken());
Assert.assertEquals(JSONToken.LITERAL_INT, NumberDeserializer.instance.getFastMatchToken());
Assert.assertEquals(JSONToken.LITERAL_INT, SqlDateDeserializer.instance.getFastMatchToken());
Assert.assertEquals(JSONToken.LBRACKET, ObjectArrayCodec.instance.getFastMatchToken());
Assert.assertEquals(JSONToken.LITERAL_STRING, CharacterCodec.instance.getFastMatchToken());
}
示例3: test_byte
import com.alibaba.fastjson.parser.deserializer.NumberDeserializer; //导入依赖的package包/类
public void test_byte() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("null", ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);
Assert.assertNull(new NumberDeserializer().deserialze(parser, null, null));
}
示例4: test_short
import com.alibaba.fastjson.parser.deserializer.NumberDeserializer; //导入依赖的package包/类
public void test_short() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("null", ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);
Assert.assertNull(new NumberDeserializer().deserialze(parser, null, null));
}
示例5: test_null
import com.alibaba.fastjson.parser.deserializer.NumberDeserializer; //导入依赖的package包/类
public void test_null() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("null", ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);
Assert.assertNull(new NumberDeserializer().deserialze(parser, null, null));
}