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


Java SerializeConfig.setAsmEnable方法代码示例

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


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

示例1: test_codec_3_asm

import com.alibaba.fastjson.serializer.SerializeConfig; //导入方法依赖的package包/类
public void test_codec_3_asm() throws Exception {
    V0 v = new V0();
    v.setValue(new BigDecimal("3.2"));
    
    SerializeConfig mapping = new SerializeConfig();
    mapping.setAsmEnable(true);
    
    String text = JSON.toJSONString(v, mapping, SerializerFeature.WriteMapNullValue);
    Assert.assertEquals("{\"value\":3.2}", text);
    
    V0 v1 = JSON.parseObject(text, V0.class);
    
    Assert.assertEquals(new BigDecimal("3.2"), v1.getValue());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:NumberFieldTest.java

示例2: test_codec_null

import com.alibaba.fastjson.serializer.SerializeConfig; //导入方法依赖的package包/类
public void test_codec_null() throws Exception {
    User user = new User();
    user.setValue(null);

    SerializeConfig mapping = new SerializeConfig();
    mapping.setAsmEnable(false);
    String text = JSON.toJSONString(user, mapping, SerializerFeature.WriteMapNullValue);

    User user1 = JSON.parseObject(text, User.class);

    Assert.assertEquals(user1.getValue(), user.getValue());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:UUIDFieldTest.java

示例3: test_codec_asm

import com.alibaba.fastjson.serializer.SerializeConfig; //导入方法依赖的package包/类
public void test_codec_asm() throws Exception {
    V0 v = new V0();
    v.setValue(new Date());

    SerializeConfig mapping = new SerializeConfig();
    mapping.setAsmEnable(true);

    String text = JSON.toJSONString(v, mapping, SerializerFeature.WriteMapNullValue);
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", JSON.defaultLocale);
    format.setTimeZone(JSON.defaultTimeZone);
    Assert.assertEquals("{\"value\":" + JSON.toJSONString(format.format(v.getValue())) + "}", text);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:DateFieldTest4.java

示例4: test_1

import com.alibaba.fastjson.serializer.SerializeConfig; //导入方法依赖的package包/类
public void test_1() throws Exception {
    SerializeConfig config = new SerializeConfig();
    config.setAsmEnable(true);
    
    String text = JSON.toJSONString(new Entity(), config);
    Assert.assertEquals("{\"value\":null}", text);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:FeaturesTest.java

示例5: test_codec

import com.alibaba.fastjson.serializer.SerializeConfig; //导入方法依赖的package包/类
public void test_codec() throws Exception {
    User user = new User();
    user.setValue(Charset.forName("UTF-8"));

    SerializeConfig mapping = new SerializeConfig();
    mapping.setAsmEnable(false);
    String text = JSON.toJSONString(user, mapping, SerializerFeature.WriteMapNullValue);

    User user1 = JSON.parseObject(text, User.class);

    Assert.assertEquals(user1.getValue(), user.getValue());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:CharsetFieldTest.java

示例6: test_codec_2_no_asm

import com.alibaba.fastjson.serializer.SerializeConfig; //导入方法依赖的package包/类
public void test_codec_2_no_asm() throws Exception {
    V0 v = new V0();
    v.setValue(Long.MAX_VALUE);
    
    SerializeConfig mapping = new SerializeConfig();
    mapping.setAsmEnable(false);

    String text = JSON.toJSONString(v, mapping, SerializerFeature.WriteMapNullValue);
    Assert.assertEquals("{\"value\":" + Long.MAX_VALUE + "}", text);

    V0 v1 = JSON.parseObject(text, V0.class);

    Assert.assertEquals(new Long(Long.MAX_VALUE), v1.getValue());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:NumberFieldTest.java

示例7: test_codec_no_asm

import com.alibaba.fastjson.serializer.SerializeConfig; //导入方法依赖的package包/类
public void test_codec_no_asm() throws Exception {
    V0 v = new V0();
    v.setValue(new Date());

    SerializeConfig mapping = new SerializeConfig();
    mapping.setAsmEnable(false);

    String text = JSON.toJSONString(v, mapping, SerializerFeature.WriteMapNullValue);
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", JSON.defaultLocale);
    format.setTimeZone(JSON.defaultTimeZone);
    Assert.assertEquals("{\"value\":" + JSON.toJSONString(format.format(v.getValue())) + "}", text);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:DateFieldTest4.java

示例8: test_codec_asm

import com.alibaba.fastjson.serializer.SerializeConfig; //导入方法依赖的package包/类
public void test_codec_asm() throws Exception {
    V0 v = new V0();
    v.setValue(new Date());
    
    SerializeConfig mapping = new SerializeConfig();
    mapping.put(Date.class, new SimpleDateFormatSerializer("yyyy-MM-dd"));
    mapping.setAsmEnable(true);
    
    String text = JSON.toJSONString(v, mapping, SerializerFeature.WriteMapNullValue);
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", JSON.defaultLocale);
    format.setTimeZone(JSON.defaultTimeZone);
    Assert.assertEquals("{\"value\":" + JSON.toJSONString(format.format(v.getValue())) + "}", text);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:DateFieldTest3.java

示例9: test_codec_null_1

import com.alibaba.fastjson.serializer.SerializeConfig; //导入方法依赖的package包/类
public void test_codec_null_1() throws Exception {
    V0 v = new V0();

    SerializeConfig mapping = new SerializeConfig();
    mapping.setAsmEnable(false);

    Assert.assertEquals("{\"value\":null}", JSON.toJSONString(v, mapping, SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullListAsEmpty));
    Assert.assertEquals("{value:null}", JSON.toJSONStringZ(v, mapping, SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullListAsEmpty));
    Assert.assertEquals("{value:null}", JSON.toJSONStringZ(v, mapping, SerializerFeature.UseSingleQuotes, SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullListAsEmpty));
    Assert.assertEquals("{'value':null}", JSON.toJSONStringZ(v, mapping, SerializerFeature.UseSingleQuotes, SerializerFeature.QuoteFieldNames, SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullListAsEmpty));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:FileFieldTest.java

示例10: test_0

import com.alibaba.fastjson.serializer.SerializeConfig; //导入方法依赖的package包/类
public void test_0() throws Exception {
    SerializeConfig config = new SerializeConfig();
    config.setAsmEnable(false);
    
    String text = JSON.toJSONString(new Entity(), config);
    Assert.assertEquals("{\"value\":\"\"}", text);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:FeaturesTest4.java

示例11: test_codec

import com.alibaba.fastjson.serializer.SerializeConfig; //导入方法依赖的package包/类
public void test_codec() throws Exception {
    User user = new User();
    user.setValue(URI.create("http://www.alibaba.com/abc"));

    SerializeConfig mapping = new SerializeConfig();
    mapping.setAsmEnable(false);
    String text = JSON.toJSONString(user, mapping, SerializerFeature.WriteMapNullValue);

    User user1 = JSON.parseObject(text, User.class);

    Assert.assertEquals(user1.getValue(), user.getValue());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:URIFieldTest.java

示例12: test_codec_null

import com.alibaba.fastjson.serializer.SerializeConfig; //导入方法依赖的package包/类
public void test_codec_null() throws Exception {
    V0 v = new V0();

    SerializeConfig mapping = new SerializeConfig();
    mapping.setAsmEnable(false);

    String text = JSON.toJSONString(v, mapping, SerializerFeature.WriteMapNullValue);
    Assert.assertEquals("{\"value\":null}", text);

    V0 v1 = JSON.parseObject(text, V0.class);

    Assert.assertEquals(v1.getValue(), v.getValue());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:AtomicLongArrayFieldTest.java

示例13: test_codec_null_1

import com.alibaba.fastjson.serializer.SerializeConfig; //导入方法依赖的package包/类
public void test_codec_null_1() throws Exception {
    V0 v = new V0();

    SerializeConfig mapping = new SerializeConfig();
    mapping.setAsmEnable(false);

    String text = JSON.toJSONString(v, mapping, SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullNumberAsZero);
    Assert.assertEquals("{\"value\":null}", text);

    V0 v1 = JSON.parseObject(text, V0.class);

    Assert.assertEquals(null, v1.getValue());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:DateFieldTest2.java


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