當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。