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 encoding `JsonObject` instances.

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `accepts​(WireFormat format)` |
    `GrpcMessage` | `encode​(T msg, WireFormat format)` |
    `static <T extends com.google.protobuf.MessageLite> GrpcMessageEncoder<T>` | `encoder()` | Create an encoder for arbitrary message extending `MessageLite`.
    `static <T> GrpcMessageEncoder<T>` | `json()` | Create and reutrn an encoder in JSON format encoding instances of `MessageOrBuilder` using the protobuf-java-util library otherwise using `Json.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 encoding `JsonObject` instances.

  - ### Method Detail

    - #### encoder

          static <T extends com.google.protobuf.MessageLite> GrpcMessageEncoder<T> encoder()

      Create an encoder for arbitrary message extending `MessageLite`.
      Returns:
        the message encoder

    - #### json

          static <T> GrpcMessageEncoder<T> json()

      Create and reutrn an encoder in JSON format encoding instances of `MessageOrBuilder` using the protobuf-java-util library otherwise using `Json.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)