Class JSONSource
- java.lang.Object
-
- cc.carm.lib.configuration.source.section.ConfigureSource<SECTION,ORIGINAL,SELF>
-
- cc.carm.lib.configuration.source.file.FileConfigSource<SourcedSection,java.util.Map<java.lang.String,java.lang.Object>,JSONSource>
-
- cc.carm.lib.configuration.source.json.JSONSource
-
- All Implemented Interfaces:
ConfigureSection
public class JSONSource extends FileConfigSource<SourcedSection,java.util.Map<java.lang.String,java.lang.Object>,JSONSource>
-
-
Field Summary
Fields Modifier and Type Field Description static @NotNull com.google.gson.GsonDEFAULT_GSONprotected @NotNull com.google.gson.Gsongsonprotected @Nullable SourcedSectionrootSection-
Fields inherited from class cc.carm.lib.configuration.source.file.FileConfigSource
file, resourcePath
-
Fields inherited from class cc.carm.lib.configuration.source.section.ConfigureSource
holder, lastUpdateMillis
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedJSONSource(@NotNull ConfigurationHolder<? extends JSONSource> holder, @NotNull java.io.File file, @Nullable java.lang.String resourcePath)protectedJSONSource(@NotNull ConfigurationHolder<? extends JSONSource> holder, @NotNull java.io.File file, @Nullable java.lang.String resourcePath, @NotNull com.google.gson.Gson gson)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidinitialize()protected voidonReload()Reload the configuration.@NotNull java.util.Map<java.lang.String,java.lang.Object>original()voidsave()Save the whole configuration.@NotNull SourcedSectionsection()protected @NotNull JSONSourceself()java.lang.StringtoString()-
Methods inherited from class cc.carm.lib.configuration.source.file.FileConfigSource
charset, copyDefaults, fileInputStream, fileOutputStream, fileReader, fileReadString, fileReadString, fileWriter, getResource, initializeFile, saveResource
-
Methods inherited from class cc.carm.lib.configuration.source.section.ConfigureSource
asMap, createSection, get, getKeys, getLastUpdateMillis, getValues, holder, isExpired, parent, path, pathSeparator, reload, remove, set
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface cc.carm.lib.configuration.source.section.ConfigureSection
childPath, computeSection, computeSection, computeSection, computeSection, contains, containsValue, createSection, createSection, createSection, forEach, fullPath, get, get, get, get, getBoolean, getBoolean, getByte, getByte, getByteList, getChar, getChar, getCharList, getCollection, getDouble, getDouble, getDoubleList, getFloat, getFloat, getFloatList, getInt, getInt, getIntegerList, getList, getList, getLong, getLong, getLongList, getSection, getShort, getShort, getString, getString, getStringList, isBoolean, isByte, isChar, isDouble, isEmpty, isFloat, isInt, isList, isLong, isRoot, isSection, isShort, isString, isType, keys, size, stream, stream, stream, values
-
-
-
-
Field Detail
-
DEFAULT_GSON
@NotNull public static final @NotNull com.google.gson.Gson DEFAULT_GSON
-
gson
@NotNull protected final @NotNull com.google.gson.Gson gson
-
rootSection
@Nullable protected @Nullable SourcedSection rootSection
-
-
Constructor Detail
-
JSONSource
protected JSONSource(@NotNull @NotNull ConfigurationHolder<? extends JSONSource> holder, @NotNull @NotNull java.io.File file, @Nullable @Nullable java.lang.String resourcePath)
-
JSONSource
protected JSONSource(@NotNull @NotNull ConfigurationHolder<? extends JSONSource> holder, @NotNull @NotNull java.io.File file, @Nullable @Nullable java.lang.String resourcePath, @NotNull @NotNull com.google.gson.Gson gson)
-
-
Method Detail
-
initialize
public void initialize()
-
self
@NotNull protected @NotNull JSONSource self()
- Specified by:
selfin classConfigureSource<SourcedSection,java.util.Map<java.lang.String,java.lang.Object>,JSONSource>
-
original
@NotNull public @NotNull java.util.Map<java.lang.String,java.lang.Object> original()
- Specified by:
originalin classConfigureSource<SourcedSection,java.util.Map<java.lang.String,java.lang.Object>,JSONSource>- Returns:
- The original configuration object.
-
section
@NotNull public @NotNull SourcedSection section()
- Specified by:
sectionin classConfigureSource<SourcedSection,java.util.Map<java.lang.String,java.lang.Object>,JSONSource>- Returns:
- The root
ConfigureSection, which represents the entire configuration.
-
save
public void save() throws java.lang.ExceptionDescription copied from class:ConfigureSourceSave the whole configuration.- Specified by:
savein classConfigureSource<SourcedSection,java.util.Map<java.lang.String,java.lang.Object>,JSONSource>- Throws:
java.lang.Exception- If any error occurs while saving.
-
onReload
protected void onReload() throws java.lang.ExceptionDescription copied from class:ConfigureSourceReload the configuration.
This used for implementation, for external usage, useConfigureSource.reload()- Specified by:
onReloadin classConfigureSource<SourcedSection,java.util.Map<java.lang.String,java.lang.Object>,JSONSource>- Throws:
java.lang.Exception- If any error occurs while reloading.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-