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

net.abc.tool.util.config.PropertyUtils Maven / Gradle / Ivy

package net.abc.tool.util.config;

import java.io.IOException;
import java.io.InputStream;

/**
 * @author: zhangwei
 * @date: 18:15/2018-11-30
 */
public class PropertyUtils extends BasePropertyUtils {

    private static final Class SUPPORT = PropertyUtils.class;

    public PropertyUtils() throws IOException {
        this(DEFALUE_CONFIG_NAME);
    }

    public PropertyUtils(String resource) throws IOException {
        this(resource, true);
    }

    public PropertyUtils(String resource, boolean conver) throws IOException {
        InputStream input = loadResource(resource);
        updateParamMap(SUPPORT, input, conver);
    }

    public static String get(String key){
        return get(SUPPORT, key);
    }

    public static String get(String key, String defalue){
        return get(SUPPORT, key, defalue);
    }

    public static Long getLong(String key){
        return getLong(SUPPORT, key);
    }

    public static Long getLong(String key, Long defalue){
        return getLong(SUPPORT, key, defalue);
    }

    public static Integer getInt(String key){
        return getInt(SUPPORT, key);
    }

    public static Integer getInt(String key, Integer defalue){
        return getInt(SUPPORT, key, defalue);
    }

    public static Short getShort(String key){
        return getShort(SUPPORT, key);
    }

    public static Short getShort(String key, Short defalue){
        return getShort(SUPPORT, key, defalue);
    }

    public static Double getDouble(String key){
        return getDouble(SUPPORT, key);
    }

    public static Double getDouble(String key, Double defalue){
        return getDouble(SUPPORT, key, defalue);
    }

    public static Float getFloat(String key){
        return getFloat(SUPPORT, key);
    }

    public static Float getFloat(String key, Float defalue){
        return getFloat(SUPPORT, key, defalue);
    }

    public static Boolean getBoolean(String key){
        return getBoolean(SUPPORT, key);
    }

    public static Boolean getBoolean(String key, Boolean defalue){
        return getBoolean(SUPPORT, key, defalue);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy