-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParametrosUtil.java
More file actions
37 lines (31 loc) · 991 Bytes
/
ParametrosUtil.java
File metadata and controls
37 lines (31 loc) · 991 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package util;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
public class ParametrosUtil {
String caminhoParametros = "./resources/parametrosGerarRelatorio.properties";
public Properties getProp(String caminhoArquivo) {
Properties property = new Properties();
FileInputStream file = null;
try {
file = new FileInputStream(caminhoArquivo);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
property.load(file);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//props.getProperty("nome da propriedade");
return property;
}
public String getPropriedade (String propriedadeKey) {
Properties propriedades = getProp(caminhoParametros);
String valorPropriedade = propriedades.getProperty(propriedadeKey);
return valorPropriedade;
}
}