public class GsonConfigSource extends Object implements IConfigSource
| Constructor and Description |
|---|
GsonConfigSource(File file,
Function<File,Reader> readerFactory,
Function<File,Writer> writerFactory)
Deprecated.
for test. Do not use it directly unless necessary.
|
| Modifier and Type | Method and Description |
|---|---|
void |
delete()
Delete the config file.
|
void |
disable() |
boolean |
fileExists()
Check if valid .json file exists.
|
<T> Optional<T> |
get(String key) |
<T> Optional<T> |
get(String key,
Class<T> asType) |
boolean |
has(String key) |
boolean |
isSection(String key) |
Set<String> |
keys() |
void |
put(String key,
Object value) |
static <T> void |
registerSerializer(Class<T> type,
Serializer<T> serializer) |
static void |
registerValidator(ITypeValidator... validators) |
void |
reload() |
void |
saveAll() |
void |
shutdown()
Shutdown the saving tasks.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waittoPathpublic static <T> void registerSerializer(Class<T> type, Serializer<T> serializer)
public static void registerValidator(ITypeValidator... validators)
public boolean fileExists()
IConfigSourcefileExists in interface IConfigSourcepublic void reload()
reload in interface IConfigSourcepublic void disable()
disable in interface IConfigSourcepublic void saveAll()
saveAll in interface IConfigSourcepublic <T> Optional<T> get(String key, Class<T> asType)
get in interface IConfigSourcepublic <T> Optional<T> get(String key)
get in interface IConfigSourcepublic void put(String key, Object value)
put in interface IConfigSourcepublic boolean has(String key)
has in interface IConfigSourcepublic Set<String> keys()
keys in interface IConfigSourcepublic boolean isSection(String key)
isSection in interface IConfigSourcepublic void shutdown()
public void delete()
IConfigSourcedelete in interface IConfigSource