本文整理汇总了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));
}
示例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);
}
示例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);
}
示例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);
}
示例5: getValue
import com.alibaba.fastjson.serializer.SerializerFeature; //导入方法依赖的package包/类
@JSONField(serialzeFeatures = { SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullNumberAsZero })
public Integer getValue() {
return value;
}
示例6: getValue
import com.alibaba.fastjson.serializer.SerializerFeature; //导入方法依赖的package包/类
@JSONField(serialzeFeatures = { SerializerFeature.WriteMapNullValue })
public Object getValue() {
return value;
}
示例7: getValue
import com.alibaba.fastjson.serializer.SerializerFeature; //导入方法依赖的package包/类
@JSONField(serialzeFeatures = { SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullListAsEmpty })
public List getValue() {
return value;
}
示例8: getValue
import com.alibaba.fastjson.serializer.SerializerFeature; //导入方法依赖的package包/类
@JSONField(serialzeFeatures = { SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullBooleanAsFalse })
public Boolean getValue() {
return value;
}
示例9: getValue
import com.alibaba.fastjson.serializer.SerializerFeature; //导入方法依赖的package包/类
@JSONField(serialzeFeatures = { SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullStringAsEmpty })
public String getValue() {
return value;
}