@ExperimentalApi(value="Experimental until Lite is stable in protobuf") public class ProtoLiteUtils extends Object
Modifier and Type | Method and Description |
---|---|
static <T extends com.google.protobuf.MessageLite> |
marshaller(T defaultInstance)
Create a
Marshaller for protos of the same type as defaultInstance . |
static <T extends com.google.protobuf.MessageLite> |
metadataMarshaller(T instance)
Produce a metadata marshaller for a protobuf type.
|
static void |
setExtensionRegistry(com.google.protobuf.ExtensionRegistryLite newRegistry)
Sets the global registry for proto marshalling shared across all servers and clients.
|
@ExperimentalApi(value="https://github.com/grpc/grpc-java/issues/1787") public static void setExtensionRegistry(com.google.protobuf.ExtensionRegistryLite newRegistry)
Warning: This API will likely change over time. It is not possible to have separate registries per Process, Server, Channel, Service, or Method. This is intentional until there is a more appropriate API to set them.
Warning: Do NOT modify the extension registry after setting it. It is thread safe to call
setExtensionRegistry(com.google.protobuf.ExtensionRegistryLite)
, but not to modify the underlying object.
If you need custom parsing behavior for protos, you will need to make your own
MethodDescriptor.Marhsaller
for the time being.
public static <T extends com.google.protobuf.MessageLite> MethodDescriptor.Marshaller<T> marshaller(T defaultInstance)
Marshaller
for protos of the same type as defaultInstance
.public static <T extends com.google.protobuf.MessageLite> Metadata.BinaryMarshaller<T> metadataMarshaller(T instance)