Package io.vertx.grpc.common
Interface GrpcMessageEncoder<T>
-
public interface GrpcMessageEncoder<T>
-
-
Field Summary
Fields Modifier and Type Field Description static GrpcMessageEncoder<Buffer>
IDENTITY
static GrpcMessageEncoder<JsonObject>
JSON_OBJECT
An encoder in JSON format encodingJsonObject
instances.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description GrpcMessage
encode(T msg)
static <T extends com.google.protobuf.MessageLite>
GrpcMessageEncoder<T>encoder()
Create an encoder for arbitrary message extendingMessageLite
.WireFormat
format()
static <T> GrpcMessageEncoder<T>
json()
Create and reutrn an encoder in JSON format encoding instances ofMessageOrBuilder
using the protobuf-java-util library otherwise usingJson.encodeToBuffer(Object)
(Jackson Databind is required).
-
-
-
Field Detail
-
IDENTITY
static final GrpcMessageEncoder<Buffer> IDENTITY
-
JSON_OBJECT
static final GrpcMessageEncoder<JsonObject> JSON_OBJECT
An encoder in JSON format encodingJsonObject
instances.
-
-
Method Detail
-
encoder
static <T extends com.google.protobuf.MessageLite> GrpcMessageEncoder<T> encoder()
Create an encoder for arbitrary message extendingMessageLite
.- Returns:
- the message encoder
-
json
static <T> GrpcMessageEncoder<T> json()
Create and reutrn an encoder in JSON format encoding instances ofMessageOrBuilder
using the protobuf-java-util library otherwise usingJson.encodeToBuffer(Object)
(Jackson Databind is required).- Returns:
- an encoder in JSON format encoding instances of
<T>
.
-
encode
GrpcMessage encode(T msg)
-
format
WireFormat format()
-
-