All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.yangyouwang.core.BaseReflexWrapper Maven / Gradle / Ivy

There is a newer version: 1.8
Show newest version
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);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy