见注释
private void buildSettingMap() throws SecurityException {
settingMap = new HashMap<Class<?>, Method>();
for (Method m1 : setting.getClass().getMethods()) {
Class<?>[] pts = m1.getParameterTypes();
if (pts.length == 1 && Castor.class.isAssignableFrom(pts[0])) {
settingMap.put(pts[0], m1);
//为啥不做 break ?
}
}
}
//在 fillmap 时取settingMap里的method为什么要双检索?
Method m = settingMap.get(castor.getClass());
if (null == m) {
for (Entry<Class<?>, Method> entry : settingMap.entrySet()) {
Class<?> cc = entry.getKey();
if (cc.isAssignableFrom(klass)) {
m = settingMap.get(cc);
break;
}
}
}
if (null != m)
m.invoke(setting, castor);