Class 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
    • 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.Builder builder()
      Creates a new GsonConfigurationLoader 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 a TypeSerializerCollection 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
      • 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

      • gsonSerializers

        public static org.spongepowered.configurate.serialize.TypeSerializerCollection gsonSerializers()
        Get a TypeSerializerCollection for handling Gson types.

        Currently, this serializer can handle:

        • JsonElement and its subtypes: JsonArray, JsonObject, JsonPrimitive, and JsonNull
        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 class org.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 class org.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 class org.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)