Contents
Class RecordField<Type, FieldType>
java.lang.Object
com.hypixel.hytale.codec.record.RecordField<Type, FieldType>
- Type Parameters:
Type- the record type this component belongs to.FieldType- the component type.
A single component of a
RecordCodec.
The accessor reads the component from an existing instance when encoding. When decoding
the value is placed into the constructor argument array at index, which matches the order
the component was appended to the builder. The validator, documentation, and metadata surface
mirrors BuilderField; record fields do not carry the per-field version-range or inheritance
support a builder field has.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classMutable configuration for aRecordField, supplied through the 3-argumentappendon the builder. -
Method Summary
Modifier and TypeMethodDescriptionvoidDecodesbsonValue(the value already fetched for this field's key) and stores the result inargsat this field's constructor position.voiddecodeJson(RawJsonReader reader, Object[] args, ExtraInfo extraInfo) Decodes the next JSON value fromreaderand stores it inargsat this field's constructor position.voidgetCodec()booleanbooleantoString()voidupdateSchema(SchemaContext context, Schema target) void
-
Method Details
-
getCodec
-
getDocumentation
-
hasNonNullValidator
public boolean hasNonNullValidator() -
isPrimitive
public boolean isPrimitive() -
encode
-
decode
public void decode(@Nonnull org.bson.BsonValue bsonValue, @Nonnull Object[] args, @Nonnull ExtraInfo extraInfo) DecodesbsonValue(the value already fetched for this field's key) and stores the result inargsat this field's constructor position. Theargsarray is shared across all of a record's fields and is passed to the constructor once decoding completes. -
decodeJson
public void decodeJson(@Nonnull RawJsonReader reader, @Nonnull Object[] args, @Nonnull ExtraInfo extraInfo) throws IOException Decodes the next JSON value fromreaderand stores it inargsat this field's constructor position. The caller is expected to have pushed this field's key already.- Throws:
IOException
-
validate
-
updateSchema
-
toString
-