Class ProtobufKeysProvider

java.lang.Object
io.micronaut.serde.protobuf.ProtobufKeysProvider
All Implemented Interfaces:
KeysProvider

@Internal public final class ProtobufKeysProvider extends Object implements KeysProvider
Contributes the property names of a Keys set to the protobuf backend.

Object properties are dispatched by index, but protobuf needs the field number the index stands for, and that is only reachable through the property name. Contributing the names here lets the encoder and decoder translate an index into a field number without a per-property lookup on the hot path.

Since:
3.2
  • Constructor Details

    • ProtobufKeysProvider

      public ProtobufKeysProvider()
      Default constructor.
  • Method Details

    • keysType

      public Class<?> keysType()
      Description copied from interface: KeysProvider
      The contribution type supplied by this provider.
      Specified by:
      keysType in interface KeysProvider
      Returns:
      The contribution type
    • create

      public Object[] create(List<String> keys)
      Description copied from interface: KeysProvider
      Create backend-specific data for the supplied keys. The returned value must be safe to reuse across encoder and decoder instances.
      Specified by:
      create in interface KeysProvider
      Parameters:
      keys - The keys
      Returns:
      The backend-specific data