map类型特殊,我在注册时出现错误 code ParaProcessorBuilder.me.regist(Map.class, MapGetter.class,null); error The method regist(Class, Class>, String) in the type ParaProcessorBuilder is not applicable for the arguments (Class, Class, null) 归根结底是 Map.class;不是正确的语法,错误提示如下 Syntax error, insert "AssignmentOperator Expression" to complete Expression 但是Integer.class是正确的语法 fastjson为了解决这个问题引入了TypeReference
1: 参考 com.jfinal.core.paragetter.IntegerGetter.java 实现一个 MapGetter
里头的核心代码是:
public Map get(Action action, Controller c) {
return c.getKv(getParameterName(), getDefaultValue());
}
2: 注册一下这个扩展:
ParaProcessorBuilder.me().regist(Map.class, MapGetter.class, ....);