io.github.yangyouwang.core.BaseReflexWrapper Maven / Gradle / Ivy
package io.github.yangyouwang.core;
import io.github.yangyouwang.annotion.Wrapper;
import java.util.HashMap;
import java.util.Map;
/**
* 反射获取属性值
* @author yangyouwang
*/
public abstract class BaseReflexWrapper {
protected final Map wrapTheMap(Wrapper wrapperAnnotation, String fieldName, String fieldValue) {
String[] dictData = wrapperAnnotation.dictData();
String dictName = wrapperAnnotation.name();
Map result = new HashMap<>(16);
for (String dict : dictData) {
result.putAll(wrapTheType(dictName, dict, fieldName, fieldValue));
}
return result;
}
/**
* wrapper 类型
* @param dictName 字典名称
* @param dictData 字典数据
* @param fieldName 属性
* @param fieldValue 值
* @return 包装Map
*/
protected abstract Map wrapTheType(String dictName, String dictData, String fieldName, String fieldValue);
}