Class ProtoCodecs

java.lang.Object
com.codename1.io.grpc.ProtoCodecs

public final class ProtoCodecs extends java.lang.Object

Runtime registry that wires @ProtoMessage classes to their build-time-generated ProtoCodecs. The generated cn1app.ProtoBootstrap calls register(Class, ProtoCodec) for every protobuf message in the project; generated gRPC client impls and per-class codecs call lookup(Class) to resolve nested-message types at runtime.

Mirrors RestClients.

  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> ProtoCodec<T>
    lookup(java.lang.Class<T> type)
    Returns the codec previously registered for type.
    static <T> void
    register(java.lang.Class<T> type, ProtoCodec<T> codec)
    Registers a codec for a @ProtoMessage class.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • register

      public static <T> void register(java.lang.Class<T> type, ProtoCodec<T> codec)
      Registers a codec for a @ProtoMessage class. Called from the generated cn1app.ProtoBootstrap.
    • lookup

      public static <T> ProtoCodec<T> lookup(java.lang.Class<T> type)
      Returns the codec previously registered for type. Throws IllegalStateException when no codec is registered so the failure is loud rather than silent (typical cause: the generated cn1app.ProtoBootstrap hasn't run, or type isn't annotated @ProtoMessage).