2017-06-04 23:54:32 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2017 univento.eu - All rights reserved
|
|
|
|
* You are not allowed to use, distribute or modify this code
|
|
|
|
*/
|
|
|
|
|
2016-08-02 23:53:40 +02:00
|
|
|
package eu.univento.commons.configuration;
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.InputStream;
|
|
|
|
import java.util.Properties;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author joethei
|
2017-02-18 18:08:45 +01:00
|
|
|
* @version 1.0
|
2016-08-02 23:53:40 +02:00
|
|
|
*/
|
|
|
|
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));
|
|
|
|
}
|
|
|
|
}
|