cool.linco.common.convert.RenderMap Maven / Gradle / Ivy
The newest version!
package cool.linco.common.convert;
import java.util.HashMap;
/**
* @author linco
* 自定义渲染map
* 可以全局定义一个通用map,处理唯一渲染规则字段
*/
public class RenderMap extends HashMap {
public RenderMap put(String dictKey, FieldNameUtil.SFunction keyFun,
FieldNameUtil.SFunction valueFun) {
this.put(dictKey, new RenderRule(FieldNameUtil.getField(keyFun), FieldNameUtil.getField(valueFun)));
return this;
}
public RenderMap put(String dictKey, String keyField, String valueField){
this.put(dictKey, new RenderRule(keyField, valueField));
return this;
}
}
/**
* eg: Map USER_ROLE_RENDER = new RenderMap().put(USER_ROLE_DICT_NAME, SysUser::getId, UserVO::getRole);
* */
© 2015 - 2025 Weber Informatics LLC | Privacy Policy