aboutsummaryrefslogtreecommitdiff
path: root/protobuf
diff options
context:
space:
mode:
authorCarl Mastrangelo <notcarl@google.com>2018-09-25 10:49:43 -0700
committerGitHub <noreply@github.com>2018-09-25 10:49:43 -0700
commit32bb5ba156c78c72c3e0702ef3e15f33869407bd (patch)
treec9350e01dd64f23a443f12cbf1d6e5b07e713afa /protobuf
parent5e4d9a591ede57b4271e5a6413c93e1be1d50001 (diff)
downloadgrpc-grpc-java-32bb5ba156c78c72c3e0702ef3e15f33869407bd.tar.gz
protobuf: expose ExtensionRegistry setter
Diffstat (limited to 'protobuf')
-rw-r--r--protobuf/src/main/java/io/grpc/protobuf/ProtoUtils.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/protobuf/src/main/java/io/grpc/protobuf/ProtoUtils.java b/protobuf/src/main/java/io/grpc/protobuf/ProtoUtils.java
index a230d5043..7d197ab82 100644
--- a/protobuf/src/main/java/io/grpc/protobuf/ProtoUtils.java
+++ b/protobuf/src/main/java/io/grpc/protobuf/ProtoUtils.java
@@ -16,6 +16,7 @@
package io.grpc.protobuf;
+import com.google.protobuf.ExtensionRegistry;
import com.google.protobuf.Message;
import io.grpc.ExperimentalApi;
import io.grpc.Metadata;
@@ -28,6 +29,25 @@ import io.grpc.protobuf.lite.ProtoLiteUtils;
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}.
*
* @since 1.0.0