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


Java SerializerFeature.WriteMapNullValue方法代码示例

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


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

示例1: test_nullList

import com.alibaba.fastjson.serializer.SerializerFeature; //导入方法依赖的package包/类
public void test_nullList() {
    SerializerFeature[] features = { SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullListAsEmpty };
    Assert.assertEquals("{\"names\":[]}", JSON.toJSONString(new VO1(), features));
    Assert.assertEquals("{\"names\":[]}", JSON.toJSONString(new VO2(), features));
    Assert.assertEquals("{\"names\":[]}", JSON.toJSONString(new VO3(), features));
    Assert.assertEquals("{\"names\":[]}", JSON.toJSONString(new VO4(), features));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:WriteNullListAsEmptyTest.java

示例2: test_bytes

import com.alibaba.fastjson.serializer.SerializerFeature; //导入方法依赖的package包/类
public void test_bytes() throws Exception {
    VO vo = new VO();

    SerializeConfig mapping = new SerializeConfig();
    mapping.setAsmEnable(false);
    SerializerFeature[] features = { SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullListAsEmpty };
    String text1 = JSON.toJSONString(vo, mapping, features);

    Assert.assertEquals("{\"value\":[]}", text1);
    String text2 = JSON.toJSONString(vo, features);

    Assert.assertEquals("{\"value\":[]}", text2);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:ByteArrayTest.java

示例3: test_bytes_1

import com.alibaba.fastjson.serializer.SerializerFeature; //导入方法依赖的package包/类
public void test_bytes_1() throws Exception {
    VO vo = new VO();
    vo.setValue(new byte[] {1, 2, 3});

    SerializeConfig mapping = new SerializeConfig();
    mapping.setAsmEnable(false);
    SerializerFeature[] features = { SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullListAsEmpty };
    String text1 = JSON.toJSONString(vo, mapping, features);

    Assert.assertEquals("{\"value\":\"AQID\"}", text1);
    String text2 = JSON.toJSONString(vo, features);

    Assert.assertEquals("{\"value\":\"AQID\"}", text2);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:ByteArrayTest.java

示例4: test_0

import com.alibaba.fastjson.serializer.SerializerFeature; //导入方法依赖的package包/类
public void test_0() throws Exception {
    SerializerFeature[] features = { SerializerFeature.WriteMapNullValue,

    SerializerFeature.WriteEnumUsingToString, SerializerFeature.SortField };

    Entity entity = new Entity();
    JSON.toJSONString(entity, features);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:Bug_for_chengchao.java

示例5: getValue

import com.alibaba.fastjson.serializer.SerializerFeature; //导入方法依赖的package包/类
@JSONField(serialzeFeatures = { SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullNumberAsZero })
public Integer getValue() {
    return value;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:FeaturesTest2.java

示例6: getValue

import com.alibaba.fastjson.serializer.SerializerFeature; //导入方法依赖的package包/类
@JSONField(serialzeFeatures = { SerializerFeature.WriteMapNullValue })
public Object getValue() {
    return value;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:FeaturesTest.java

示例7: getValue

import com.alibaba.fastjson.serializer.SerializerFeature; //导入方法依赖的package包/类
@JSONField(serialzeFeatures = { SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullListAsEmpty })
public List getValue() {
    return value;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:FeaturesTest6.java

示例8: getValue

import com.alibaba.fastjson.serializer.SerializerFeature; //导入方法依赖的package包/类
@JSONField(serialzeFeatures = { SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullBooleanAsFalse })
public Boolean getValue() {
    return value;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:FeaturesTest5.java

示例9: getValue

import com.alibaba.fastjson.serializer.SerializerFeature; //导入方法依赖的package包/类
@JSONField(serialzeFeatures = { SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullStringAsEmpty })
public String getValue() {
    return value;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:FeaturesTest4.java


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