-
Notifications
You must be signed in to change notification settings - Fork 0
/
Config.java
67 lines (51 loc) · 1.35 KB
/
Config.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
55
56
57
58
59
60
61
62
63
64
65
66
67
import java.util.*;
public class Config
{
private LinkedHashMap<String, Property> properties = new LinkedHashMap<>();
private HashMap<String, String> config = new HashMap<>();
public Config(HashMap<String, String> config)
{
this.config = config;
}
public Config() {}
public boolean load()
{
for(Property property : this.properties.values())
{
String data = this.config.get(property.getKey());
property.setProperty(data);
}
return true;
}
public void initializeConfigFile()
{
for(Property property : this.properties.values())
{
//this.config.put(property.getKey(), property.getDefaultValue());
}
}
public void add(Property property)
{
this.properties.put(property.getKey(), property);
}
public void add(LinkedList<Property> properties)
{
for(Property property : properties)
{
this.properties.put(property.getKey(), property);
}
}
public Property get(String key)
{
return this.properties.get(key);
}
public Property get(Class object)
{
for(Property property : this.properties.values())
{
if(property.getClass() == object)
return property;
}
return null;
}
}