protobuf: add metadataMarshaller to ProtoUtils

This commit is contained in:
Carl Mastrangelo 2018-05-21 16:26:27 -07:00 committed by GitHub
parent 451c412354
commit 8635de36a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -37,7 +37,15 @@ public class ProtoUtils {
public static <T extends Message> Metadata.Key<T> keyForProto(T instance) {
return Metadata.Key.of(
instance.getDescriptorForType().getFullName() + Metadata.BINARY_HEADER_SUFFIX,
ProtoLiteUtils.metadataMarshaller(instance));
metadataMarshaller(instance));
}
/**
* Produce a metadata marshaller for a protobuf type.
*/
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/4477")
public static <T extends Message> Metadata.BinaryMarshaller<T> metadataMarshaller(T instance) {
return ProtoLiteUtils.metadataMarshaller(instance);
}
private ProtoUtils() {