Package com.google.protobuf.util
Class JsonFormat.TypeRegistry
- java.lang.Object
-
- com.google.protobuf.util.JsonFormat.TypeRegistry
-
- Enclosing class:
- JsonFormat
public static class JsonFormat.TypeRegistry extends java.lang.Object
A TypeRegistry is used to resolve Any messages in the JSON conversion. You must provide a TypeRegistry containing all message types used in Any message fields, or the JSON conversion will fail because data in Any message fields is unrecognizable. You don't need to supply a TypeRegistry if you don't use Any message fields.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JsonFormat.TypeRegistry.Builder
A Builder is used to buildJsonFormat.TypeRegistry
.private static class
JsonFormat.TypeRegistry.EmptyTypeRegistryHolder
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,Descriptors.Descriptor>
types
-
Constructor Summary
Constructors Modifier Constructor Description private
TypeRegistry(java.util.Map<java.lang.String,Descriptors.Descriptor> types)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Descriptors.Descriptor
find(java.lang.String name)
Find a type by its full name.(package private) Descriptors.Descriptor
getDescriptorForTypeUrl(java.lang.String typeUrl)
static JsonFormat.TypeRegistry
getEmptyTypeRegistry()
static JsonFormat.TypeRegistry.Builder
newBuilder()
-
-
-
Field Detail
-
types
private final java.util.Map<java.lang.String,Descriptors.Descriptor> types
-
-
Constructor Detail
-
TypeRegistry
private TypeRegistry(java.util.Map<java.lang.String,Descriptors.Descriptor> types)
-
-
Method Detail
-
getEmptyTypeRegistry
public static JsonFormat.TypeRegistry getEmptyTypeRegistry()
-
newBuilder
public static JsonFormat.TypeRegistry.Builder newBuilder()
-
find
@Nullable public Descriptors.Descriptor find(java.lang.String name)
Find a type by its full name. Returns null if it cannot be found in thisJsonFormat.TypeRegistry
.
-
getDescriptorForTypeUrl
@Nullable Descriptors.Descriptor getDescriptorForTypeUrl(java.lang.String typeUrl) throws InvalidProtocolBufferException
- Throws:
InvalidProtocolBufferException
-
-