Package org.spongepowered.plugin.meta
Class McModInfo.Builder
java.lang.Object
org.spongepowered.plugin.meta.McModInfo.Builder
- Enclosing class:
- McModInfo
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 Summary
Modifier and TypeMethodDescriptionbuild()Builds theMcModInfoserializer using the specified options.gson()Returns theGsonBuilderthat will be used to build this serializer'sGsoninstance.registerExtension(String key, Class<?> extensionClass) Registers an extension with the given key and the specified extension class.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.
-
Method Details
-
gson
Returns theGsonBuilderthat will be used to build this serializer'sGsoninstance. Modify the builder if you need to set custom options to make your extension serializer work properly.- Returns:
- The GSON builder
-
registerExtension
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 extensionextensionClass- The class to serialize the extension to- Returns:
- This builder instance
-
registerExtension
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 extensionextensionClass- The class to serialize the extension totypeAdapter- The type adapter to use for serializing- Returns:
- This builder instance
- See Also:
-
build
Builds theMcModInfoserializer using the specified options.- Returns:
- The built serializer
-