Interface IConfigValueSerializer<T>
- Type Parameters:
T- effectively immutable value type with stable equality
- All Known Subinterfaces:
IConfigKeyValueSerializer<T,,K, V> IConfigListValueSerializer<T>
Prefer built-in value methods when possible. For a custom type, implement this interface and pass it to
IConfigCategoryBuilder.addValue(String, Object, IConfigValueSerializer). Implement
IConfigListValueSerializer when editors should work with list elements individually, or
IConfigKeyValueSerializer when editors should work with two components of an entry.
Accepted values must be effectively immutable with stable equality. Serialization must be deterministic, and every
accepted value must deserialize back to an equal value without diagnostics. Deserialization must report invalid input
through IDeserializeResult rather than throw; every returned value must pass isValid(Object). Shared
serializer instances must be thread-safe.
- Since:
- 0.1.0
-
Method Summary
Modifier and TypeMethodDescriptiondeserialize(String string) Parse stored text, returning diagnostics instead of throwing when the input is invalid.List every valid choice when config editors should present a fixed selection.default Optional<ConfigValueRange<T>> getRange()Describe an inclusive range that config editors can present with a bounded control.Describe valid input for config editors and error messages.booleanReturn whether this value can be safely stored.Convert a valid value to its stable text representation.
-
Method Details
-
serialize
Convert a valid value to its stable text representation.- Since:
- 0.1.0
-
deserialize
Parse stored text, returning diagnostics instead of throwing when the input is invalid.- Since:
- 0.1.0
-
isValid
Return whether this value can be safely stored.- Since:
- 0.1.0
-
getRange
Describe an inclusive range that config editors can present with a bounded control.- Since:
- 0.1.0
-
getAllValidValues
List every valid choice when config editors should present a fixed selection.The returned list must be unmodifiable and duplicate-free. Its order must remain stable while the set of valid values is unchanged. Return
Optional.empty()for open-ended value types.- Since:
- 0.1.0
-
getValidValuesDescription
String getValidValuesDescription()Describe valid input for config editors and error messages.- Since:
- 0.1.0
-