Interface IConfigKeyValueSerializer<T,K,V>

Type Parameters:
T - entry type
K - key type
V - component value type
All Superinterfaces:
IConfigValueSerializer<T>

public interface IConfigKeyValueSerializer<T,K,V> extends IConfigValueSerializer<T>
Lets config editors treat a mod-specific value as separately editable key and value components.

This is useful for map-like entries in an ordered list, where changing the Java type to Map would lose entry order or other domain data. Each component serializer defines its own editor and validation behavior; rebuilding an unchanged entry must produce an equal value. Every accepted entry must have valid components, and createEntry(Object, Object) must accept every component pair allowed by the component serializers.

Since:
0.1.0
  • Method Details

    • getKeySerializer

      IConfigValueSerializer<K> getKeySerializer()
      Get the serializer for the key.
      Returns:
      key serializer
      Since:
      0.1.0
    • getValueSerializer

      IConfigValueSerializer<V> getValueSerializer()
      Get the serializer for the component value.
      Returns:
      component value serializer
      Since:
      0.1.0
    • getKey

      K getKey(T entry)
      Get the key from the entry.
      Parameters:
      entry - key-value entry
      Returns:
      key component
      Since:
      0.1.0
    • getValue

      V getValue(T entry)
      Get the component value from the entry.
      Parameters:
      entry - key-value entry
      Returns:
      value component
      Since:
      0.1.0
    • createEntry

      T createEntry(K key, V value)
      Create an entry from edited key and value components. This must return without throwing when both components are accepted by their serializers.
      Parameters:
      key - key component
      value - value component
      Returns:
      key-value entry
      Since:
      0.1.0