Class GsonConfigurationLoader
- java.lang.Object
-
- org.spongepowered.configurate.loader.AbstractConfigurationLoader<BasicConfigurationNode>
-
- org.spongepowered.configurate.gson.GsonConfigurationLoader
-
- All Implemented Interfaces:
ConfigurationNodeFactory<BasicConfigurationNode>,ConfigurationLoader<BasicConfigurationNode>
public final class GsonConfigurationLoader extends AbstractConfigurationLoader<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.
-
Field Summary
-
Fields inherited from class org.spongepowered.configurate.loader.AbstractConfigurationLoader
CONFIGURATE_LINE_PATTERN, CONFIGURATE_LINE_SEPARATOR, sink, source, SYSTEM_LINE_SEPARATOR
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static @NonNull GsonConfigurationLoader.Builderbuilder()Creates a newGsonConfigurationLoaderbuilder.protected voidcheckCanWrite(ConfigurationNode node)BasicConfigurationNodecreateNode(ConfigurationOptions options)static TypeSerializerCollectiongsonSerializers()Get aTypeSerializerCollectionfor handling Gson types.protected voidloadInternal(BasicConfigurationNode node, java.io.BufferedReader reader)protected voidsaveInternal(ConfigurationNode node, java.io.Writer writer)-
Methods inherited from class org.spongepowered.configurate.loader.AbstractConfigurationLoader
canLoad, canSave, defaultCommentHandler, defaultOptions, load, loadToReference, save, writeHeaderInternal
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.spongepowered.configurate.loader.ConfigurationLoader
load
-
Methods inherited from interface org.spongepowered.configurate.ConfigurationNodeFactory
createNode, createNode, createNode, toListCollector, toListCollector, toMapCollector, toMapCollector
-
-
-
-
Method Detail
-
builder
public static @NonNull GsonConfigurationLoader.Builder builder()
Creates a newGsonConfigurationLoaderbuilder.- Returns:
- a new builder
- Since:
- 4.0.0
-
gsonSerializers
public static 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(ConfigurationNode node) throws ConfigurateException
- Overrides:
checkCanWritein classAbstractConfigurationLoader<BasicConfigurationNode>- Throws:
ConfigurateException
-
loadInternal
protected void loadInternal(BasicConfigurationNode node, java.io.BufferedReader reader) throws ParsingException
- Specified by:
loadInternalin classAbstractConfigurationLoader<BasicConfigurationNode>- Throws:
ParsingException
-
saveInternal
protected void saveInternal(ConfigurationNode node, java.io.Writer writer) throws ConfigurateException
- Specified by:
saveInternalin classAbstractConfigurationLoader<BasicConfigurationNode>- Throws:
ConfigurateException
-
createNode
public BasicConfigurationNode createNode(ConfigurationOptions options)
-
-