Package io.apicurio.registry.serde
Class OptimisticFallbackIdHandler
java.lang.Object
io.apicurio.registry.serde.Default4ByteIdHandler
io.apicurio.registry.serde.OptimisticFallbackIdHandler
- All Implemented Interfaces:
IdHandler
IdHandler that tries to read a 4-byte ID, but if it sees all zeros in those 4 bytes,
it assumes it was actually an 8-byte ID and reads the full 8 bytes.
This handler is optimistic in that it makes the following assumptions on schema IDs (global or content):
- Schema IDs are strictly positive (non-zero)
- Schema IDs are less than or equal to the max value of a signed 4-byte integer
This is useful during a migration from Apicurio Registry v2 to v3, deserializing data that may have been written by either a 4-byte (default) or 8-byte (legacy) ID handler.
-
Field Summary
Fields inherited from class io.apicurio.registry.serde.Default4ByteIdHandler
idOption -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintidSize(ArtifactReference reference, ByteBuffer buffer) readId(ByteBuffer buffer) Methods inherited from class io.apicurio.registry.serde.Default4ByteIdHandler
configure, idSize, writeId, writeId
-
Constructor Details
-
OptimisticFallbackIdHandler
public OptimisticFallbackIdHandler()
-
-
Method Details
-
readId
- Specified by:
readIdin interfaceIdHandler- Overrides:
readIdin classDefault4ByteIdHandler- See Also:
-
idSize
-