java.lang.Object
org.spongepowered.plugin.meta.McModInfo.Builder
Enclosing class:
McModInfo

public static final class McModInfo.Builder extends Object
Represents a builder for McModInfo serializes that can be used to construct a serializer that serializes specific extension keys to their Java object representation.
  • Method Details

    • gson

      public GsonBuilder gson()
      Returns the GsonBuilder that will be used to build this serializer's Gson instance. Modify the builder if you need to set custom options to make your extension serializer work properly.
      Returns:
      The GSON builder
    • registerExtension

      public McModInfo.Builder registerExtension(String key, Class<?> extensionClass)
      Registers an extension with the given key and the specified extension class. By default, GSON will serializer the extension class using a representation of the public fields.
      Parameters:
      key - The key of the extension
      extensionClass - The class to serialize the extension to
      Returns:
      This builder instance
    • registerExtension

      public McModInfo.Builder registerExtension(String key, Class<?> extensionClass, Object typeAdapter)
      Registers an extension with the given key, extension class and a custom type adapter to use for serializing the extension class.
      Parameters:
      key - The key of the extension
      extensionClass - The class to serialize the extension to
      typeAdapter - The type adapter to use for serializing
      Returns:
      This builder instance
      See Also:
    • build

      public McModInfo build()
      Builds the McModInfo serializer using the specified options.
      Returns:
      The built serializer