- 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
-
Method Details
-
decode
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
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.
-