本文整理汇总了Java中com.alibaba.fastjson.parser.ParserConfig.setAsmEnable方法的典型用法代码示例。如果您正苦于以下问题:Java ParserConfig.setAsmEnable方法的具体用法?Java ParserConfig.setAsmEnable怎么用?Java ParserConfig.setAsmEnable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.alibaba.fastjson.parser.ParserConfig
的用法示例。
在下文中一共展示了ParserConfig.setAsmEnable方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test_codec_null_asm
import com.alibaba.fastjson.parser.ParserConfig; //导入方法依赖的package包/类
public void test_codec_null_asm() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(true);
String text = JSON.toJSONString(v, mapping,
SerializerFeature.WriteMapNullValue);
Assert.assertEquals("{\"value\":123}", text);
ParserConfig config = new ParserConfig();
config.setAsmEnable(false);
V0 v1 = JSON.parseObject(text, V0.class, config,
JSON.DEFAULT_PARSER_FEATURE);
Assert.assertEquals(v1.getValue(), v.getValue());
}
示例2: test_codec_null
import com.alibaba.fastjson.parser.ParserConfig; //导入方法依赖的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);
ParserConfig config = new ParserConfig();
config.setAutoTypeSupport(true);
config.setAsmEnable(false);
V0 v1 = JSON.parseObject(text, V0.class, config, JSON.DEFAULT_PARSER_FEATURE);
Assert.assertEquals(v1.getValue(), v.getValue());
}
示例3: test_create_2
import com.alibaba.fastjson.parser.ParserConfig; //导入方法依赖的package包/类
public void test_create_2() throws Exception {
Entity entity = new Entity(123, "菜姐");
String text = JSON.toJSONString(entity);
ParserConfig config = new ParserConfig();
config.setAsmEnable(false);
Entity entity2 = JSON.parseObject(text, Entity.class, config, 0);
Assert.assertEquals(entity.getId(), entity2.getId());
Assert.assertEquals(entity.getName(), entity2.getName());
}
示例4: test_0
import com.alibaba.fastjson.parser.ParserConfig; //导入方法依赖的package包/类
public void test_0() throws Exception {
Group admin = new Group("admin");
User jobs = new User("jobs");
User sager = new User("sager");
User sdh5724 = new User("sdh5724");
admin.getMembers().add(jobs);
jobs.getGroups().add(admin);
admin.getMembers().add(sager);
sager.getGroups().add(admin);
admin.getMembers().add(sdh5724);
sdh5724.getGroups().add(admin);
sager.setReportTo(sdh5724);
jobs.setReportTo(sdh5724);
SerializeConfig serializeConfig = new SerializeConfig();
serializeConfig.setAsmEnable(false);
String text = JSON.toJSONString(admin, serializeConfig, SerializerFeature.PrettyFormat);
System.out.println(text);
ParserConfig config = new ParserConfig();
config.setAsmEnable(false);
JSON.parseObject(text, Group.class, config, 0);
}
示例5: test_0
import com.alibaba.fastjson.parser.ParserConfig; //导入方法依赖的package包/类
public void test_0() throws Exception {
Entity entity = new Entity(123, new Child());
entity.getChild().setParent(entity);
String text = JSON.toJSONString(entity);
System.out.println(text);
ParserConfig config = new ParserConfig();
config.setAsmEnable(false);
Entity entity2 = JSON.parseObject(text, Entity.class, config, 0);
Assert.assertEquals(entity2, entity2.getChild().getParent());
System.out.println(JSON.toJSONString(entity2));
}
示例6: test_no_asm
import com.alibaba.fastjson.parser.ParserConfig; //导入方法依赖的package包/类
public void test_no_asm() throws Exception {
ParserConfig mapping = new ParserConfig();
mapping.setAsmEnable(false);
Assert.assertEquals(false, mapping.isAsmEnable());
mapping.setAsmEnable(true);
Assert.assertEquals(true, mapping.isAsmEnable());
}
示例7: test_codec_null
import com.alibaba.fastjson.parser.ParserConfig; //导入方法依赖的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);
ParserConfig config = new ParserConfig();
config.setAsmEnable(false);
V0 v1 = JSON.parseObject(text, V0.class, config, JSON.DEFAULT_PARSER_FEATURE);
Assert.assertEquals(v1.getValue(), v.getValue());
}
示例8: test_codec_null
import com.alibaba.fastjson.parser.ParserConfig; //导入方法依赖的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);
ParserConfig config = new ParserConfig();
config.setAsmEnable(false);
V0 v1 = JSON.parseObject(text, V0.class, config, JSON.DEFAULT_PARSER_FEATURE);
Assert.assertEquals(v1.getValue(), v.getValue());
}
示例9: test_codec_null_asm
import com.alibaba.fastjson.parser.ParserConfig; //导入方法依赖的package包/类
public void test_codec_null_asm() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(true);
String text = JSON.toJSONString(v, mapping, SerializerFeature.WriteMapNullValue);
Assert.assertEquals("{\"value\":null}", text);
ParserConfig config = new ParserConfig();
config.setAsmEnable(false);
V0 v1 = JSON.parseObject(text, V0.class, config, JSON.DEFAULT_PARSER_FEATURE);
Assert.assertEquals(v1.getValue(), v.getValue());
}