Package ch.njol.yggdrasil
Interface YggdrasilSerializable.YggdrasilRobustSerializable
- All Superinterfaces:
YggdrasilSerializable
- All Known Implementing Classes:
Direction
- Enclosing interface:
YggdrasilSerializable
public static interface YggdrasilSerializable.YggdrasilRobustSerializable
extends YggdrasilSerializable
A class that has had fields added, changed, or removed from it should implement this
interface to handle the now invalid/missing fields that may still be read from stream.
-
Nested Class Summary
Nested classes/interfaces inherited from interface ch.njol.yggdrasil.YggdrasilSerializable
YggdrasilSerializable.YggdrasilExtendedSerializable, YggdrasilSerializable.YggdrasilRobustEnum, YggdrasilSerializable.YggdrasilRobustSerializable
-
Method Summary
Modifier and TypeMethodDescriptionboolean
excessiveField
(@NotNull Fields.FieldContext field) Called if a field was read from stream which does not exist in this class.boolean
incompatibleField
(@NotNull Field field, @NotNull Fields.FieldContext value) Called if a field that was read from stream is of an incompatible type to the existing field in this class.boolean
missingField
(@NotNull Field field) Called if a field was not found in the stream.
-
Method Details
-
incompatibleField
boolean incompatibleField(@NotNull @NotNull Field field, @NotNull @NotNull Fields.FieldContext value) throws StreamCorruptedException Called if a field that was read from stream is of an incompatible type to the existing field in this class.- Parameters:
field
- The Java fieldvalue
- The field read from stream- Returns:
- Whether the field was handled. If false,
yggdrasil.
incompatibleField
(this, field, value) will be called. - Throws:
StreamCorruptedException
-
excessiveField
Called if a field was read from stream which does not exist in this class.- Parameters:
field
- The field read from stream- Returns:
- Whether the field was handled. If false,
yggdrasil.
excessiveField
(this, field) will be called. - Throws:
StreamCorruptedException
-
missingField
Called if a field was not found in the stream.- Parameters:
field
- The field that did not occur in the stream- Returns:
- Whether the field was handled (e.g. true if the default value is fine). If false,
yggdrasil.
missingField
(this, field) will be called. - Throws:
StreamCorruptedException
-