Class JsonFormat.Parser
java.lang.Object
com.google.protobuf.util.JsonFormat.Parser
- Enclosing class:
JsonFormat
A Parser parses the ProtoJSON format into a protobuf message.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate final ExtensionRegistryprivate final booleanprivate final booleanprivate final JsonFormat.TypeRegistryprivate final intprivate final TypeRegistry -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateParser(TypeRegistry registry, JsonFormat.TypeRegistry oldRegistry, ExtensionRegistry extensionRegistry, boolean ignoreUnknownFields, int recursionLimit, boolean legacyLenient) -
Method Summary
Modifier and TypeMethodDescriptionCreates a newJsonFormat.Parserconfigured to not throw an exception when an unknown field is encountered.voidmerge(Reader json, Message.Builder builder) Parses from the ProtoJSON encoding into a protobuf message.voidmerge(String json, Message.Builder builder) Parses from the ProtoJSON format into a protobuf message.(package private) JsonFormat.ParserusingExtensionRegistry(ExtensionRegistry extensionRegistry) Creates a newJsonFormat.Parserusing the given extension registry.(package private) JsonFormat.ParserusingRecursionLimit(int recursionLimit) usingTypeRegistry(TypeRegistry registry) Creates a newJsonFormat.Parserusing the given registry.usingTypeRegistry(JsonFormat.TypeRegistry oldRegistry) Creates a newJsonFormat.Parserusing the given registry.
-
Field Details
-
registry
-
oldRegistry
-
extensionRegistry
-
ignoringUnknownFields
private final boolean ignoringUnknownFields -
recursionLimit
private final int recursionLimit -
legacyLenient
private final boolean legacyLenient -
DEFAULT_RECURSION_LIMIT
private static final int DEFAULT_RECURSION_LIMIT- See Also:
-
-
Constructor Details
-
Parser
private Parser(TypeRegistry registry, JsonFormat.TypeRegistry oldRegistry, ExtensionRegistry extensionRegistry, boolean ignoreUnknownFields, int recursionLimit, boolean legacyLenient)
-
-
Method Details
-
usingTypeRegistry
Creates a newJsonFormat.Parserusing the given registry. The new Parser clones all other configurations from this Parser.- Throws:
IllegalArgumentException- if a registry is already set
-
usingTypeRegistry
Creates a newJsonFormat.Parserusing the given registry. The new Parser clones all other configurations from this Parser.- Throws:
IllegalArgumentException- if a registry is already set
-
usingExtensionRegistry
Creates a newJsonFormat.Parserusing the given extension registry. The new Parser clones all other configurations from this Parser. -
ignoringUnknownFields
Creates a newJsonFormat.Parserconfigured to not throw an exception when an unknown field is encountered. The new Parser clones all other configurations from this Parser. -
merge
Parses from the ProtoJSON format into a protobuf message.- Throws:
InvalidProtocolBufferException- if the input is not valid JSON proto3 format or there are unknown fields in the input.
-
merge
Parses from the ProtoJSON encoding into a protobuf message.- Throws:
InvalidProtocolBufferException- if the input is not valid ProtoJSON format or there are unknown fields in the inputIOException- if reading from the input throws
-
usingRecursionLimit
-