Class FieldBuilder<T>
java.lang.Object
com.github.darksoulq.abyssallib.common.serialization.FieldBuilder<T>
- Type Parameters:
T- The type of the field's value.
A builder for defining a field within a structured record codec.
-
Constructor Summary
ConstructorsConstructorDescriptionFieldBuilder(String name, Codec<T> codec, boolean optional, T defaultValue) Constructs the intermediary field builder. -
Method Summary
Modifier and TypeMethodDescriptionRegisters alternative string paths to parse seamlessly mapping backward-compatibility configurations efficiently.<O> RecordField<O, T> Binds this field definition to a getter function of the parent object, anchoring the type context.<O> RecordField<O, T> Binds this field definition to a getter function of the parent object.
-
Constructor Details
-
FieldBuilder
Constructs the intermediary field builder.- Parameters:
name- The structural identifier for the field map key.codec- The target codec resolving the data.optional- Whether the field's absence should be tolerated.defaultValue- The fallback primitive value to utilize if missing.
-
-
Method Details
-
alias
Registers alternative string paths to parse seamlessly mapping backward-compatibility configurations efficiently.- Parameters:
alternatives- Collection encapsulating legacy iteration node parsing path parameters cleanly.- Returns:
- Chaining reference modifying parent structural definitions properly mapped safely.
-
forGetter
Binds this field definition to a getter function of the parent object.- Type Parameters:
O- The parent object type.- Parameters:
getter- The function used to retrieve the field's value from the parent.- Returns:
- A completed record field definition ready for use in a RecordBuilder.
-
forGetter
Binds this field definition to a getter function of the parent object, anchoring the type context.- Type Parameters:
O- The parent object type.- Parameters:
type- The class literal of the parent object.getter- The function used to retrieve the field's value from the parent.- Returns:
- A completed record field definition ready for use in a RecordBuilder.
-