mirror of https://github.com/grpc/grpc-java.git
protobuf: expose ExtensionRegistry setter
This commit is contained in:
parent
5e4d9a591e
commit
32bb5ba156
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
package io.grpc.protobuf;
|
package io.grpc.protobuf;
|
||||||
|
|
||||||
|
import com.google.protobuf.ExtensionRegistry;
|
||||||
import com.google.protobuf.Message;
|
import com.google.protobuf.Message;
|
||||||
import io.grpc.ExperimentalApi;
|
import io.grpc.ExperimentalApi;
|
||||||
import io.grpc.Metadata;
|
import io.grpc.Metadata;
|
||||||
|
|
@ -27,6 +28,25 @@ import io.grpc.protobuf.lite.ProtoLiteUtils;
|
||||||
*/
|
*/
|
||||||
public final class ProtoUtils {
|
public final class ProtoUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the global registry for proto marshalling shared across all servers and clients.
|
||||||
|
*
|
||||||
|
* <p>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.
|
||||||
|
*
|
||||||
|
* <p>Warning: Do NOT modify the extension registry after setting it. It is thread safe to call
|
||||||
|
* {@link #setExtensionRegistry}, but not to modify the underlying object.
|
||||||
|
*
|
||||||
|
* <p>If you need custom parsing behavior for protos, you will need to make your own
|
||||||
|
* {@code MethodDescriptor.Marshaller} for the time being.
|
||||||
|
*
|
||||||
|
* @since 1.16.0
|
||||||
|
*/
|
||||||
|
public static void setExtensionRegistry(ExtensionRegistry registry) {
|
||||||
|
ProtoLiteUtils.setExtensionRegistry(registry);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a {@link Marshaller} for protos of the same type as {@code defaultInstance}.
|
* Create a {@link Marshaller} for protos of the same type as {@code defaultInstance}.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue