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 classGsonConfigurationLoader.BuilderBuilds aGsonConfigurationLoader.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static @NonNull GsonConfigurationLoader.Builderbuilder()Creates a newGsonConfigurationLoaderbuilder.protected voidcheckCanWrite(org.spongepowered.configurate.ConfigurationNode node)org.spongepowered.configurate.BasicConfigurationNodecreateNode(org.spongepowered.configurate.ConfigurationOptions options)static org.spongepowered.configurate.serialize.TypeSerializerCollectiongsonSerializers()Get aTypeSerializerCollectionfor handling Gson types.protected voidloadInternal(org.spongepowered.configurate.BasicConfigurationNode node, BufferedReader reader)protected voidsaveInternal(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 newGsonConfigurationLoaderbuilder.- Returns:
- a new builder
- Since:
- 4.0.0
-
gsonSerializers
public static org.spongepowered.configurate.serialize.TypeSerializerCollection gsonSerializers()
Get aTypeSerializerCollectionfor handling Gson types.Currently, this serializer can handle:
JsonElementand 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:
checkCanWritein 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:
loadInternalin 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:
saveInternalin 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)
-
-