Search in sources :

Example 1 with Printer

use of com.google.protobuf.util.JsonFormat.Printer in project grpc-java by grpc.

the class ProtoUtils method jsonMarshaller.

/**
   * Create a {@code Marshaller} for json protos of the same type as {@code defaultInstance}.
   *
   * <p>This is an unstable API and has not been optimized yet for performance.
   */
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1786")
public static <T extends Message> Marshaller<T> jsonMarshaller(final T defaultInstance) {
    final Parser parser = JsonFormat.parser();
    final Printer printer = JsonFormat.printer();
    return jsonMarshaller(defaultInstance, parser, printer);
}
Also used : Printer(com.google.protobuf.util.JsonFormat.Printer) Parser(com.google.protobuf.util.JsonFormat.Parser) ExperimentalApi(io.grpc.ExperimentalApi)

Aggregations

Parser (com.google.protobuf.util.JsonFormat.Parser)1 Printer (com.google.protobuf.util.JsonFormat.Printer)1 ExperimentalApi (io.grpc.ExperimentalApi)1