39 lines
861 B
Java
39 lines
861 B
Java
package eu.univento.commons.configuration;
|
|
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.util.Properties;
|
|
|
|
/**
|
|
* @author joethei
|
|
* @version 1.0
|
|
*/
|
|
public class ConfigurationHandler {
|
|
|
|
private Properties properties;
|
|
|
|
public ConfigurationHandler() {
|
|
properties = new Properties();
|
|
InputStream in;
|
|
try {
|
|
in = getClass().getResourceAsStream("/config.properties");
|
|
properties.load(in);
|
|
in.close();
|
|
} catch (IOException e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
private Object getProperty(String key) {
|
|
return properties.getProperty(key);
|
|
}
|
|
|
|
public String getString(String key) {
|
|
return String.valueOf(getProperty(key));
|
|
}
|
|
|
|
public int getInteger(String key) {
|
|
return Integer.valueOf(getString(key));
|
|
}
|
|
}
|