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

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

There is a newer version: 1.8
Show newest version
package io.github.yangyouwang.core;

import io.github.yangyouwang.util.PropertiesUtil;
import java.util.HashMap;
import java.util.Map;

/**
 * config wrapper
 * @author yangyouwang
 */
public class ConfigWrapper extends BaseReflexWrapper {

    private PropertiesUtil propertiesUtil = PropertiesUtil.getInstance();

    @Override
    protected Map wrapTheType(String dictName, String dictData, String fieldName, String fieldValue) {
        String dictDataValue = propertiesUtil.read(dictData);
        String dictKey = dictData.split("\\.")[1];
        Map result = new HashMap<>(16);
        if (fieldValue.equals(dictKey)) {
            if (dictName.isEmpty()) {
                result.put(fieldName, dictDataValue);
                return result;
            }
            result.put(dictName, dictDataValue);
        }
        return result;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy