if (componentClasses != null && componentClasses.length >= 1) {
componentClass = componentClasses[0];
}
if (componentDestClass != componentClass) {
throw new BeanMappingException("error ComponentClasses config for [" + componentDestClass.getName()
+ "] to [" + componentDestClass.getName() + "]");
}
boolean isForceMapping = false; // 如果不存在上线文,默认不做强制类型转化
if (context != null) {
isForceMapping = (StringUtils.isNotEmpty(context.getNestName()) || context.getNestObject() != null);// 如果存在定义映射规则,则强制进行映射处理
}
if (isForceMapping || componentClass != null && componentSrcClass != componentClass) { // 需要进行类型转化
config = initMapping(context, componentSrcClass, componentDestClass, componentClasses);
}
for (int i = 0; i < size; i++) {
Object obj = arrayGet(src, componentSrcClass, i);
if (config != null) { // 需要进行类型转化
Object newObj = doMapping(obj, componentDestClass, config);
arraySet(objs, componentDestClass, i, newObj);
} else {
arraySet(objs, componentDestClass, i, obj);
}
}
return objs;
}
throw new BeanMappingException("Unsupported convert: [" + src + "," + destClass.getName() + "]");
}