Interface ConfigSerializer<T>

Type Parameters:
T - The type of object this serializer handles
All Known Implementing Classes:
ItemActionSerializer, ItemCraftingRecipeSerializer, ItemStackSerializer, LocationSerializer, Point2dSerializer, Polygon3dSerializer

public interface ConfigSerializer<T>
Interface for serializing and deserializing objects to and from configuration sections. Implementations of this interface can be registered with the configuration system to handle complex types.
Since:
1.0.0
  • Method Details

    • serialize

      void serialize(ConfigSerializer.SerializationArgs<T> args)
      Serialize an object to a configuration section.
      Parameters:
      args - The serialization arguments
    • deserialize

      Optional<T> deserialize(SectionWrapper section, String path)
      Deserialize an object from a configuration section.
      Parameters:
      section - The configuration section to deserialize from
      path - The path within the section to deserialize from
      Returns:
      The deserialized object
    • getType

      Class<T> getType()
      Get the type of object this serializer handles.
      Returns:
      The class of the object type
    • getSerializer

      default <S> ConfigSerializer<S> getSerializer(Class<S> type)
    • save

      default void save(ConfigSerializer.SerializationArgs<T> args)