Class MDCPropertyMapSerializer
- Direct Known Subclasses:
MDCPropertyMapSerializerV5
Serializer for MDC property maps (
Map<String, String>).
Each map is written as:
- entry count (
writeVarInt), excluding null keys and null values - for each remaining entry: key string, then value string
The default constructor caches whole maps with SerializerBase.BiMapType.DIRECT_MAP
(equals/hashCode). MDCPropertyMapSerializerV5 uses
SerializerBase.BiMapType.IDENTITY. Decode returns Map.copyOf(Map). An older stream
may still contain a null value; that entry is read and dropped.
By default key and value strings share one nested string serializer.
MDCPropertyMapSerializerV5 uses BasicStringSerializer for keys
and a caller-supplied value codec (the V5 message/argument long-string serializer).
Null maps are not handled here; callers should use writeObjectOrNull /
readObjectOrNull.
-
Nested Class Summary
Nested classes/interfaces inherited from class SerializerBase
SerializerBase.BiMapType -
Constructor Summary
ConstructorsConstructorDescriptionMDCPropertyMapSerializer(int capacity) MDCPropertyMapSerializer(SerializerBase.BiMapType biMapType, int capacity) MDCPropertyMapSerializer(SerializerBase.BiMapType biMapType, int capacity, com.esotericsoftware.kryo.kryo5.Serializer<String> keySerializer, com.esotericsoftware.kryo.kryo5.Serializer<String> valueSerializer) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.esotericsoftware.kryo.kryo5.Serializer<String> getNewEntrySerializer(int capacity) readNewEntry(com.esotericsoftware.kryo.kryo5.Kryo kryo, com.esotericsoftware.kryo.kryo5.io.Input input) protected voidwriteNewEntry(com.esotericsoftware.kryo.kryo5.Kryo kryo, com.esotericsoftware.kryo.kryo5.io.Output output, Map<String, String> map) Method called to write new entries.Methods inherited from class SerializerBase
read, writeMethods inherited from class com.esotericsoftware.kryo.kryo5.Serializer
copy, getAcceptsNull, isImmutable, setAcceptsNull, setImmutable
-
Constructor Details
-
MDCPropertyMapSerializer
- Parameters:
capacity- capacity of the whole-map cache and of the nested string cache
-
MDCPropertyMapSerializer
- Parameters:
biMapType- whole-map cache:SerializerBase.BiMapType.DIRECT_MAP(equals) orSerializerBase.BiMapType.IDENTITY(==)capacity- capacity of the whole-map cache and of the nested string cache
-
MDCPropertyMapSerializer
public MDCPropertyMapSerializer(SerializerBase.BiMapType biMapType, int capacity, com.esotericsoftware.kryo.kryo5.Serializer<String> keySerializer, com.esotericsoftware.kryo.kryo5.Serializer<String> valueSerializer) - Parameters:
biMapType- whole-map cache:SerializerBase.BiMapType.DIRECT_MAP(equals) orSerializerBase.BiMapType.IDENTITY(==)capacity- capacity of the whole-map cache; also used when this constructor allocates nested string serializerskeySerializer- key codec;nullmeansgetNewEntrySerializer(int)valueSerializer- value codec;nullmeans the same instance as keys
-
-
Method Details
-
writeNewEntry
protected void writeNewEntry(com.esotericsoftware.kryo.kryo5.Kryo kryo, com.esotericsoftware.kryo.kryo5.io.Output output, Map<String, String> map) Description copied from class:SerializerBaseMethod called to write new entries.- Specified by:
writeNewEntryin classSerializerBase<Map<String,String>> - Parameters:
kryo-output-map-
-
readNewEntry
protected Map<String,String> readNewEntry(com.esotericsoftware.kryo.kryo5.Kryo kryo, com.esotericsoftware.kryo.kryo5.io.Input input) - Specified by:
readNewEntryin classSerializerBase<Map<String,String>>
-
getNewEntrySerializer
-