Package io.vertx.grpc.common
Interface GrpcMessageEncoder<T>
-
public interface GrpcMessageEncoder<T>
-
-
Field Summary
Fields Modifier and Type Field Description static GrpcMessageEncoder<Buffer>IDENTITYstatic GrpcMessageEncoder<JsonObject>JSON_OBJECTAn encoder in JSON format encodingJsonObjectinstances.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanaccepts(WireFormat format)GrpcMessageencode(T msg, WireFormat format)static <T extends com.google.protobuf.MessageLite>
GrpcMessageEncoder<T>encoder()Create an encoder for arbitrary message extendingMessageLite.static <T> GrpcMessageEncoder<T>json()Create and reutrn an encoder in JSON format encoding instances ofMessageOrBuilderusing 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 encodingJsonObjectinstances.
-
-
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 ofMessageOrBuilderusing 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, WireFormat format) throws CodecException
- Throws:
CodecException
-
accepts
boolean accepts(WireFormat format)
-
-