Class OptimisticFallbackIdHandler

java.lang.Object
io.apicurio.registry.serde.Default4ByteIdHandler
io.apicurio.registry.serde.OptimisticFallbackIdHandler
All Implemented Interfaces:
IdHandler

public class OptimisticFallbackIdHandler extends Default4ByteIdHandler
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.