本文整理匯總了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;
}