Interface ConfigSerializer<T>

Type Parameters:
T - The type this serializer handles
All Superinterfaces:
de.exlll.configlib.Serializer<T,Map<String,Object>>
All Known Implementing Classes:
ItemStackSerializer, LocationSerializer

public interface ConfigSerializer<T> extends de.exlll.configlib.Serializer<T,Map<String,Object>>
Simple interface for creating custom configuration serializers. Serializers work directly with MemoryConfiguration for easy .set() operations.
  • Method Details

    • getTargetClass

      Class<T> getTargetClass()
      Get the class that this serializer handles.
      Returns:
      The target class
    • serialize

      void serialize(T toSerialize, org.bukkit.configuration.MemoryConfiguration config)
      Serialize an object to a MemoryConfiguration. Simply call config.set(key, value) for each field you want to serialize.
      Parameters:
      toSerialize - The object to serialize
      config - The blank MemoryConfiguration to write to
    • deserialize

      Optional<T> deserialize(SectionWrapper from)
      Deserialize an object from a SectionWrapper.
      Parameters:
      from - The SectionWrapper containing the serialized data
      Returns:
      The deserialized object
    • deserialize

      default T deserialize(Map<String,Object> stringObjectMap)
      Specified by:
      deserialize in interface de.exlll.configlib.Serializer<T,Map<String,Object>>
    • serialize

      default Map<String,Object> serialize(T t)
      Specified by:
      serialize in interface de.exlll.configlib.Serializer<T,Map<String,Object>>