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, wait
toPath
public static <T> void registerSerializer(Class<T> type, Serializer<T> serializer)
public static void registerValidator(ITypeValidator... validators)
public boolean fileExists()
IConfigSource
fileExists
in interface IConfigSource
public void reload()
reload
in interface IConfigSource
public void disable()
disable
in interface IConfigSource
public void saveAll()
saveAll
in interface IConfigSource
public <T> Optional<T> get(String key, Class<T> asType)
get
in interface IConfigSource
public <T> Optional<T> get(String key)
get
in interface IConfigSource
public void put(String key, Object value)
put
in interface IConfigSource
public boolean has(String key)
has
in interface IConfigSource
public Set<String> keys()
keys
in interface IConfigSource
public boolean isSection(String key)
isSection
in interface IConfigSource
public void shutdown()
public void delete()
IConfigSource
delete
in interface IConfigSource