public class TaggedFieldSerializer<T> extends FieldSerializer<T>
tagged
. Fields without the TaggedFieldSerializer.Tag
annotation are not serialized. New tagged fields can be added without invalidating previously serialized bytes. If any tagged
field is removed, previously serialized bytes are invalidated. Instead of removing fields, apply the Deprecated
annotation and they will still be deserialized but won't be serialized. If fields are public, bytecode generation will be used
instead of reflection.Modifier and Type | Class and Description |
---|---|
static interface |
TaggedFieldSerializer.Tag
If true, this field will not be serialized.
|
FieldSerializer.CachedField<X>, FieldSerializer.Optional
Constructor and Description |
---|
TaggedFieldSerializer(Kryo kryo,
java.lang.Class type) |
Modifier and Type | Method and Description |
---|---|
T |
read(Kryo kryo,
Input input,
java.lang.Class<T> type)
Reads bytes and returns a new object of the specified concrete type.
|
void |
removeField(java.lang.String fieldName)
Removes a field so that it won't be serialized.
|
void |
write(Kryo kryo,
Output output,
T object)
Writes the bytes for the object to the output.
|
compare, copy, getField, getFields, getType, setFieldsAsAccessible, setFieldsCanBeNull, setFixedFieldTypes, setIgnoreSyntheticFields
getAcceptsNull, isImmutable, setAcceptsNull, setGenerics, setImmutable
public TaggedFieldSerializer(Kryo kryo, java.lang.Class type)
public void removeField(java.lang.String fieldName)
FieldSerializer
removeField
in class FieldSerializer<T>
public void write(Kryo kryo, Output output, T object)
Serializer
This method should not be called directly, instead this serializer can be passed to Kryo
write methods that accept a
serialier.
write
in class FieldSerializer<T>
object
- May be null if Serializer.getAcceptsNull()
is true.public T read(Kryo kryo, Input input, java.lang.Class<T> type)
Serializer
Before Kryo can be used to read child objects, Kryo.reference(Object)
must be called with the parent object to
ensure it can be referenced by the child objects. Any serializer that uses Kryo
to read a child object may need to
be reentrant.
This method should not be called directly, instead this serializer can be passed to Kryo
read methods that accept a
serialier.
read
in class FieldSerializer<T>
Serializer.getAcceptsNull()
is true.