
net.abc.tool.util.config.StaticPropertyUtils Maven / Gradle / Ivy
package net.abc.tool.util.config;
import java.io.IOException;
import java.io.InputStream;
/**
* @author: zhangwei
* @date: 15:37/2018-12-06
*/
public class StaticPropertyUtils extends BasePropertyUtils {
private static final Class SUPPORT = StaticPropertyUtils.class;
private static final String CONFIG_NAME = "config.name";
static {
new StaticPropertyUtils(System.getProperty(CONFIG_NAME, DEFALUE_CONFIG_NAME), true);
}
private StaticPropertyUtils(String resource, boolean conver) {
InputStream input = null;
try {
input = loadResource(resource);
updateParamMap(SUPPORT, input, conver);
} catch (IOException e) {
e.printStackTrace();
}
}
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