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


Java JavaBeanSerializer.write方法代码示例

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


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

示例1: test_0_s

import com.alibaba.fastjson.serializer.JavaBeanSerializer; //导入方法依赖的package包/类
public void test_0_s() throws Exception {
    SerializeWriter out = new SerializeWriter();

    A a = new A();
    a.getL0().add("A");
    a.getL0().add("B");

    JavaBeanSerializer serializer = new JavaBeanSerializer(A.class);
    serializer.write(new JSONSerializer(out), a, null, null, 0);

    Assert.assertEquals("{\"l0\":[\"A\",\"B\"]}", out.toString());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:JavaBeanSerializerTest.java

示例2: test_1_s

import com.alibaba.fastjson.serializer.JavaBeanSerializer; //导入方法依赖的package包/类
public void test_1_s() throws Exception {
    SerializeWriter out = new SerializeWriter();

    B a = new B();
    a.getL0().add("A");
    a.getL0().add("B");

    JavaBeanSerializer serializer = new JavaBeanSerializer(B.class);
    serializer.write(new JSONSerializer(out), a, null, null, 0);

    Assert.assertEquals("{\"l0\":[\"A\",\"B\"],\"l1\":[]}", out.toString());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:JavaBeanSerializerTest.java

示例3: test_2_s

import com.alibaba.fastjson.serializer.JavaBeanSerializer; //导入方法依赖的package包/类
public void test_2_s() throws Exception {
    SerializeWriter out = new SerializeWriter();

    JavaBeanSerializer serializer = new JavaBeanSerializer(F.class);
    serializer.write(new JSONSerializer(out), new F(new E(123)), null, null, 0);

    Assert.assertEquals("{\"e\":{\"id\":123}}", out.toString());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:JavaBeanSerializerTest.java

示例4: test_3_s

import com.alibaba.fastjson.serializer.JavaBeanSerializer; //导入方法依赖的package包/类
public void test_3_s() throws Exception {
    SerializeWriter out = new SerializeWriter();

    JavaBeanSerializer serializer = new JavaBeanSerializer(F.class);
    serializer.write(new JSONSerializer(out), new F(null), null, null, 0);

    Assert.assertEquals("{}", out.toString());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:JavaBeanSerializerTest.java

示例5: test_error_s

import com.alibaba.fastjson.serializer.JavaBeanSerializer; //导入方法依赖的package包/类
public void test_error_s() throws Exception {
    JSONException error = null;
    try {
        SerializeWriter out = new SerializeWriter();
        JavaBeanSerializer serializer = new JavaBeanSerializer(C.class);
        serializer.write(new JSONSerializer(out), new C(), null, null, 0);
    } catch (JSONException e) {
        error = e;
    }
    Assert.assertNotNull(error);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:JavaBeanSerializerTest.java

示例6: test_error_1_s

import com.alibaba.fastjson.serializer.JavaBeanSerializer; //导入方法依赖的package包/类
public void test_error_1_s() throws Exception {
    JSONException error = null;
    try {
        SerializeWriter out = new SerializeWriter();
        JavaBeanSerializer serializer = new JavaBeanSerializer(D.class);
        serializer.write(new JSONSerializer(out), new D(), null, null, 0);
    } catch (JSONException e) {
        error = e;
    }
    Assert.assertNotNull(error);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:JavaBeanSerializerTest.java


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