/
PropertyReader.java
54 lines (45 loc) · 1.21 KB
/
PropertyReader.java
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package org.jboss.seam.security.examples.openid;
import java.util.Properties;
import org.jboss.seam.solder.core.Veto;
@Veto
public class PropertyReader
{
private Properties properties;
public PropertyReader(Properties properties)
{
super();
this.properties = properties;
}
public String getString(String name, String defaultValue)
{
if (properties != null)
{
return properties.getProperty(name, defaultValue);
}
return defaultValue;
}
public int getInt(String name, int defaultValue)
{
if (properties != null && properties.containsKey(name))
{
return Integer.parseInt(properties.getProperty(name));
}
return defaultValue;
}
public boolean getBoolean(String name, boolean defaultValue)
{
if (properties != null && properties.containsKey(name))
{
return Boolean.parseBoolean(properties.getProperty(name));
}
return defaultValue;
}
public String[] getStringArray(String name, String[] defaultValue)
{
if (properties != null && properties.containsKey(name))
{
return properties.getProperty(name).split(";");
}
return defaultValue;
}
}