Package io.jooby.trpc

Interface TrpcDecoder<T>

Type Parameters:
T - The target Java type this decoder produces.

public interface TrpcDecoder<T>
A pre-resolved decoder used at runtime to deserialize tRPC network payloads into complex Java objects.

This interface is heavily utilized by the Jooby Annotation Processor (APT). When compiling tRPC-annotated controllers, the APT generates highly optimized routing code that resolves the appropriate TrpcDecoder for each method argument. By pre-resolving these decoders, Jooby efficiently parses incoming JSON payloads without incurring reflection overhead on every request.

Note: Primitive types and standard wrappers (like int, String, boolean) are typically handled directly by the TrpcReader rather than requiring a dedicated decoder.

  • Method Summary

    Modifier and Type
    Method
    Description
    decode(String name, byte[] payload)
    Decodes a raw byte array payload into the target Java object.
    decode(String name, String payload)
    Decodes a string payload into the target Java object.
  • Method Details

    • decode

      T decode(String name, byte[] payload)
      Decodes a raw byte array payload into the target Java object.
      Parameters:
      name - The name of the parameter being decoded (useful for error reporting or wrapping).
      payload - The raw JSON byte array received from the network.
      Returns:
      The fully deserialized Java object.
    • decode

      T decode(String name, String payload)
      Decodes a string payload into the target Java object.
      Parameters:
      name - The name of the parameter being decoded (useful for error reporting or wrapping).
      payload - The JSON string received from the network.
      Returns:
      The fully deserialized Java object.