NameFilter序列化时修改Key
如果需要修改的关键,过程返回值则可
public interface NameFilter extends SerializeFilter {
String process(Object object, String propertyName, Object propertyValue);
}
ValueFilter序列化是修改值
public interface ValueFilter extends SerializeFilter {
Object process(Object object, String propertyName, Object propertyValue);
}
定制KEy样式序列化
NameFilter valueFilter = new NameFilter () {
@Override
public String process(Object o, String propertyName, Object propertyValue) { if(propertyName.equals("domain")){
return new String("d"); //返回修改后的属性值对象
}
if(propertyName.equals("supDomain")){
return new String("sd"); //返回修改后的属性值对象 } if(propertyName.equals("code")){
return new String("c"); //返回修改后的属性值对象
}
if(propertyName.equals("label")){
return new String("l"); //返回修改后的属性值对象 } if(propertyName.equals("shortLbl")){
return new String("sl"); //返回修改后的属性值对象 } if(propertyName.equals("shortPy")){
return new String("spy"); //返回修改后的属性值对象 } if(propertyName.equals("curlvldom")){
return new String("cld"); //返回修改后的属性值对象 } if(propertyName.equals("curlvldom")){
return new String("cld"); //返回修改后的属性值对象 } if(propertyName.equals("admlvl")){
return new String("alvl"); //返回修改后的属性值对象 } return propertyName; }
};
欢迎访问:http://lhylyw.ngrok.xiaomiqiu.cn/
免费下载各种课程设计和学习资源