if (isDebug && logger.isDebugEnabled()) {
logger.debug("====================== start mapping \n\t srcClass["
+ param.getSrcRef().getClass().toString() + "] \n\t targetClass["
+ param.getTargetRef().getClass().toString() + "]");
}
BatchObjectHolder holder = null;
BatchExecutor getBatchExecutor = null;
BatchExecutor setBatchExecutor = null;
if (config.isBatch()) { // 执行一次batch get操作,注意batch的获取操作需要放置在doFieldMapping/doBeanMapping之前
getBatchExecutor = getGetBatchExecutor(param, config);
setBatchExecutor = getSetBatchExecutor(param, config);
}
if (config.isBatch() && getBatchExecutor != null) { // 执行一次batch get操作
Object[] batchValues = getBatchExecutor.gets(param.getSrcRef());
holder = new BatchObjectHolder(batchValues);
}
List<BeanMappingField> beanFields = config.getBeanFields();
for (int i = 0, size = beanFields.size(); i < size; i++) {
BeanMappingField beanField = beanFields.get(i);
if (beanField.isMapping()) {
doBeanMapping(param, beanField, holder);
} else {
doFieldMapping(param, beanField, holder);
}
}
if (config.isBatch() && setBatchExecutor != null && holder != null) { // 执行一次batch set操作
setBatchExecutor.sets(param.getTargetRef(), holder.getBatchValues());
}
if (isDebug && logger.isDebugEnabled()) {
logger.debug("====================== end mapping");
}