Class GsonConfigurationLoader
- java.lang.Object
-
- org.spongepowered.configurate.loader.AbstractConfigurationLoader<org.spongepowered.configurate.BasicConfigurationNode>
-
- org.spongepowered.configurate.gson.GsonConfigurationLoader
-
- All Implemented Interfaces:
org.spongepowered.configurate.ConfigurationNodeFactory<org.spongepowered.configurate.BasicConfigurationNode>
,org.spongepowered.configurate.loader.ConfigurationLoader<org.spongepowered.configurate.BasicConfigurationNode>
public final class GsonConfigurationLoader extends org.spongepowered.configurate.loader.AbstractConfigurationLoader<org.spongepowered.configurate.BasicConfigurationNode>
A loader for JSON-formatted configurations, using the GSON library for parsing and generation.- Since:
- 4.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GsonConfigurationLoader.Builder
Builds aGsonConfigurationLoader
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static @NonNull GsonConfigurationLoader.Builder
builder()
Creates a newGsonConfigurationLoader
builder.protected void
checkCanWrite(org.spongepowered.configurate.ConfigurationNode node)
org.spongepowered.configurate.BasicConfigurationNode
createNode(org.spongepowered.configurate.ConfigurationOptions options)
static org.spongepowered.configurate.serialize.TypeSerializerCollection
gsonSerializers()
Get aTypeSerializerCollection
for handling Gson types.protected void
loadInternal(org.spongepowered.configurate.BasicConfigurationNode node, BufferedReader reader)
protected void
saveInternal(org.spongepowered.configurate.ConfigurationNode node, Writer writer)
-
Methods inherited from class org.spongepowered.configurate.loader.AbstractConfigurationLoader
canLoad, canSave, defaultCommentHandler, defaultOptions, load, loadToReference, save, writeHeaderInternal
-
-
-
-
Method Detail
-
builder
public static @NonNull GsonConfigurationLoader.Builder builder()
Creates a newGsonConfigurationLoader
builder.- Returns:
- a new builder
- Since:
- 4.0.0
-
gsonSerializers
public static org.spongepowered.configurate.serialize.TypeSerializerCollection gsonSerializers()
Get aTypeSerializerCollection
for handling Gson types.Currently, this serializer can handle:
JsonElement
and its subtypes:JsonArray
,JsonObject
,JsonPrimitive
, andJsonNull
- Returns:
- gson type serializers
- Since:
- 4.1.0
-
checkCanWrite
protected void checkCanWrite(org.spongepowered.configurate.ConfigurationNode node) throws org.spongepowered.configurate.ConfigurateException
- Overrides:
checkCanWrite
in classorg.spongepowered.configurate.loader.AbstractConfigurationLoader<org.spongepowered.configurate.BasicConfigurationNode>
- Throws:
org.spongepowered.configurate.ConfigurateException
-
loadInternal
protected void loadInternal(org.spongepowered.configurate.BasicConfigurationNode node, BufferedReader reader) throws org.spongepowered.configurate.loader.ParsingException
- Specified by:
loadInternal
in classorg.spongepowered.configurate.loader.AbstractConfigurationLoader<org.spongepowered.configurate.BasicConfigurationNode>
- Throws:
org.spongepowered.configurate.loader.ParsingException
-
saveInternal
protected void saveInternal(org.spongepowered.configurate.ConfigurationNode node, Writer writer) throws org.spongepowered.configurate.ConfigurateException
- Specified by:
saveInternal
in classorg.spongepowered.configurate.loader.AbstractConfigurationLoader<org.spongepowered.configurate.BasicConfigurationNode>
- Throws:
org.spongepowered.configurate.ConfigurateException
-
createNode
public org.spongepowered.configurate.BasicConfigurationNode createNode(org.spongepowered.configurate.ConfigurationOptions options)
-
-