同步操作将从 lanseba/json-config 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#json-config
oschina maven镜像构件: com.tcshuo json-config 1.0.0
,childs :{
date:{format:'yyyy-MM-dd'}
,dept:{allows:['name']}
}
public void test1() {
HashMap<Object, Object> map = new HashMap<Object, Object>();
map.put("maptype", BeanType.A);
Bean beana = new Bean("bean a", BeanType.A);
Bean beanb = new Bean("bean b", BeanType.B);
map.put("beana", beana);
map.put("beanb", beanb);
ArrayList<Bean> beanList = new ArrayList<Bean>();
beanList.add(beana);
beanList.add(beanb);
map.put("beanList", beanList);
int[] intArray = new int[]{1, 2, 3};
map.put("intArray", intArray);
Bean[] beanArray = new Bean[]{beana, beanb};
map.put("beanArray", beanArray);
toJson(null, map);
toJson("{ignore:'n'}", map);
toJson("{ignore:'n'}", beanList);
toJson("{ignore:'na',allows:['name','date'],childs:{date:{format:'yyyy年MM月'}}}", beanList);
toJson("{ignore:'na',allows:['name','type'],childs:{type:{ignore:'na',allows:['javaEnumName']}}}", beanList);
toJson("{ignore:'na',allows:['name','type'],childs:{type:{alias:{javaEnumName:'NAME'},ignore:'na',allows:['javaEnumName']}}}", beanList);
}
private void toJson(String config, Object target) {
System.out.println(JsonConfigParser.parser(config, target).toJson());
}
Running com.tcshuo.json.config.SimpleTestCase {"intArray":[1,2,3]} {"beanb":{"name":"bean b"},"beanArray":[{"name":"bean a"},{"name":"bean b"}],"beana":{"name":"bean a"},"beanList":[{"name":"bean a"},{"name":"bean b"}],"intArray":[1,2,3],"maptype":{"declaringClass":"com.tcshuo.json.config.BeanType","name":"a","value":0,"javaEnumName":"A"}} [{"name":"bean a","type":{"declaringClass":"com.tcshuo.json.config.BeanType","name":"a","value":0,"javaEnumName":"A"},"date":"2015-05-06 18:57:15"},{"name":"bean b","type":{"declaringClass":"com.tcshuo.json.config.BeanType","name":"b","value":1,"javaEnumName":"B"},"date":"2015-05-06 18:57:15"}] [{"name":"bean a","date":"2015年05月"},{"name":"bean b","date":"2015年05月"}] [{"name":"bean a","type":{"javaEnumName":"A"}},{"name":"bean b","type":{"javaEnumName":"B"}}] [{"name":"bean a","type":{"NAME":"A"}},{"name":"bean b","type":{"NAME":"B"}}]
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。