-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathConfigManager.java
More file actions
56 lines (35 loc) · 1.62 KB
/
Copy pathConfigManager.java
File metadata and controls
56 lines (35 loc) · 1.62 KB
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
package ac.grim.grimac.api.config;
import ac.grim.grimac.api.common.BasicReloadable;
import ac.grim.grimac.api.config.source.ConfigSource;
import ac.grim.grimac.api.config.source.SourceHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
import java.util.Map;
public interface ConfigManager extends BasicReloadable {
/**
* Registers a configuration source.
* The Manager looks up the registered Handler for this source type and executes it.
*/
void registerSource(@NotNull ConfigSource source);
/**
* Registers a handler logic for a specific ConfigSource type.
* Example: Registering logic for how to handle Redis sources.
*/
<T extends ConfigSource> void registerHandler(@NotNull Class<T> type, @NotNull SourceHandler<T> handler);
String getStringElse(String key, String otherwise);
@Nullable String getString(String key);
@Nullable List<String> getStringList(String key);
List<String> getStringListElse(String key, List<String> otherwise);
int getIntElse(String key, int otherwise);
long getLongElse(String key, long otherwise);
double getDoubleElse(String key, double otherwise);
boolean getBooleanElse(String key, boolean otherwise);
@Nullable <T> T get(String key);
@Nullable <T> T getElse(String key, T otherwise);
@Nullable <K, V> Map<K, V> getMap(String key);
@Nullable <K, V> Map<K, V> getMapElse(String key, Map<K, V> otherwise);
@Nullable <T> List<T> getList(String key);
@Nullable <T> List<T> getListElse(String key, List<T> otherwise);
boolean hasLoaded();
}