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


Java Feature.SupportArrayToBean方法代码示例

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


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

示例1: test_null_array_reader_1

import com.alibaba.fastjson.parser.Feature; //导入方法依赖的package包/类
public void test_null_array_reader_1() throws Exception {
    JSONReader reader = new JSONReader(new StringReader("[null ,null]"), Feature.SupportArrayToBean);
    Model model = reader.readObject(Model.class);
    assertNotNull(model);
    assertNull(model.v1);
    assertNull(model.v2);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:IntegerNullTest.java

示例2: test_1_stream

import com.alibaba.fastjson.parser.Feature; //导入方法依赖的package包/类
public void test_1_stream() throws Exception {
    String text = "[123 ,\"wenshao\"]";
    JSONReader reader = new JSONReader(new StringReader(text), Feature.SupportArrayToBean);
    VO vo2 = reader.readObject(VO.class);
    Assert.assertEquals(123, vo2.getId());
    Assert.assertEquals("wenshao", vo2.getName());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:WriteAsArray_long_public.java

示例3: test_null_array_reader

import com.alibaba.fastjson.parser.Feature; //导入方法依赖的package包/类
public void test_null_array_reader() throws Exception {
    JSONReader reader = new JSONReader(new StringReader("[\"null\" ,\"null\"]"), Feature.SupportArrayToBean);
    Model model = reader.readObject(Model.class);
    assertNotNull(model);
    assertNull(model.v1);
    assertNull(model.v2);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:IntegerNullTest.java

示例4: test_error_stream

import com.alibaba.fastjson.parser.Feature; //导入方法依赖的package包/类
public void test_error_stream() throws Exception {
    String text = "[123.,\"wenshao\"]";
    Exception error = null;
    try {
        JSONReader reader = new JSONReader(new StringReader(text), Feature.SupportArrayToBean);
        reader.readObject(VO.class);
        reader.close();
    } catch (JSONException ex) {
        error = ex;
    }
    Assert.assertNotNull(error);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:WriteAsArray_long_public.java

示例5: test_error_stream_1

import com.alibaba.fastjson.parser.Feature; //导入方法依赖的package包/类
public void test_error_stream_1() throws Exception {
    String text = "[123:\"wenshao\" ]";
    Exception error = null;
    try {
        JSONReader reader = new JSONReader(new StringReader(text), Feature.SupportArrayToBean);
        reader.readObject(VO.class);
        reader.close();
    } catch (JSONException ex) {
        error = ex;
    }
    Assert.assertNotNull(error);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:WriteAsArray_long_public.java

示例6: test_error_stream_2

import com.alibaba.fastjson.parser.Feature; //导入方法依赖的package包/类
public void test_error_stream_2() throws Exception {
    String text = "[-123:\"wenshao\" ]";
    Exception error = null;
    try {
        JSONReader reader = new JSONReader(new StringReader(text), Feature.SupportArrayToBean);
        reader.readObject(VO.class);
        reader.close();
    } catch (JSONException ex) {
        error = ex;
    }
    Assert.assertNotNull(error);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:WriteAsArray_long_public.java

示例7: test_error_value_notmatch_stream

import com.alibaba.fastjson.parser.Feature; //导入方法依赖的package包/类
public void test_error_value_notmatch_stream() throws Exception {
    String text = "[true,\"wenshao\"]";
    Exception error = null;
    try {
        JSONReader reader = new JSONReader(new StringReader(text), Feature.SupportArrayToBean);
        reader.readObject(VO.class);
        reader.close();
    } catch (JSONException ex) {
        error = ex;
    }
    Assert.assertNotNull(error);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:WriteAsArray_long_public.java

示例8: test_2_stream

import com.alibaba.fastjson.parser.Feature; //导入方法依赖的package包/类
public void test_2_stream() throws Exception {
    String text = "[-123 ,\"wenshao\"]";
    JSONReader reader = new JSONReader(new StringReader(text), Feature.SupportArrayToBean);
    VO vo2 = reader.readObject(VO.class);
    Assert.assertEquals(-123, vo2.getId());
    Assert.assertEquals("wenshao", vo2.getName());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:WriteAsArray_int_public.java

示例9: test_error_overflow_stream

import com.alibaba.fastjson.parser.Feature; //导入方法依赖的package包/类
public void test_error_overflow_stream() throws Exception {
    String text = "[2147483649:\"wenshao\" ]";
    Exception error = null;
    try {
        JSONReader reader = new JSONReader(new StringReader(text), Feature.SupportArrayToBean);
        reader.readObject(VO.class);
        reader.close();
    } catch (JSONException ex) {
        error = ex;
    }
    Assert.assertNotNull(error);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:WriteAsArray_int_public.java

示例10: test_error_value_notmatch_2_stream

import com.alibaba.fastjson.parser.Feature; //导入方法依赖的package包/类
public void test_error_value_notmatch_2_stream() throws Exception {
    String text = "[+,\"wenshao\"]";
    Exception error = null;
    try {
        JSONReader reader = new JSONReader(new StringReader(text), Feature.SupportArrayToBean);
        reader.readObject(VO.class);
        reader.close();
    } catch (JSONException ex) {
        error = ex;
    }
    Assert.assertNotNull(error);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:WriteAsArray_int_public.java

示例11: test_0

import com.alibaba.fastjson.parser.Feature; //导入方法依赖的package包/类
public void test_0 () throws Exception {
    VO vo = new VO();
    vo.setId(123);
    vo.setName("wenshao");
    
    String text = JSON.toJSONString(vo, SerializerFeature.BeanToArray);
    Assert.assertEquals("[123,\"wenshao\"]", text);
    JSONReader reader = new JSONReader(new StringReader(text), Feature.SupportArrayToBean);
    VO vo2 = reader.readObject(VO.class);
    Assert.assertEquals(vo.getId(), vo2.getId());
    Assert.assertEquals(vo.getName(), vo2.getName());
    reader.close();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:WriteAsArray_long_stream_public.java

示例12: test_for_error

import com.alibaba.fastjson.parser.Feature; //导入方法依赖的package包/类
public void test_for_error() throws Exception {
    
    JSONReader reader = new JSONReader(new StringReader("[1001,\"wenshao\"]"), Feature.SupportArrayToBean);
    Model model = reader.readObject(Model.class);
    Assert.assertEquals(1001, model.id);
    Assert.assertEquals("wenshao", model.name);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:ArrayMapping_long_stream.java

示例13: test_min_array

import com.alibaba.fastjson.parser.Feature; //导入方法依赖的package包/类
public void test_min_array() throws Exception {
    V0 v = new V0();
    v.setValue(Long.MIN_VALUE);

    String text = JSON.toJSONString(v, SerializerFeature.BeanToArray);

    JSONReader reader = new JSONReader(new StringReader(text), Feature.SupportArrayToBean);
    V0 v1 = reader.readObject(V0.class);

    Assert.assertEquals(v1.getValue(), v.getValue());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:LongFieldTest_2_stream.java

示例14: test_max_array

import com.alibaba.fastjson.parser.Feature; //导入方法依赖的package包/类
public void test_max_array() throws Exception {
    V0 v = new V0();
    v.setValue(Long.MIN_VALUE);

    String text = JSON.toJSONString(v, SerializerFeature.BeanToArray);

    JSONReader reader = new JSONReader(new StringReader(text), Feature.SupportArrayToBean);
    V0 v1 = reader.readObject(V0.class);

    Assert.assertEquals(v.getValue(), v1.getValue());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:LongFieldTest_2_stream.java


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