Package com.google.protobuf.util
Class JsonFormat.Parser
java.lang.Object
com.google.protobuf.util.JsonFormat.Parser
- Enclosing class:
- JsonFormat
A Parser parses the proto3 JSON format into a protobuf message.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate final booleanprivate final JsonFormat.TypeRegistryprivate final intprivate final TypeRegistry -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateParser(TypeRegistry registry, JsonFormat.TypeRegistry oldRegistry, boolean ignoreUnknownFields, int recursionLimit) -
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 proto3 JSON encoding into a protobuf message.voidmerge(String json, Message.Builder builder) Parses from the proto3 JSON format into a protobuf message.(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
-
ignoringUnknownFields
private final boolean ignoringUnknownFields -
recursionLimit
private final int recursionLimit -
DEFAULT_RECURSION_LIMIT
private static final int DEFAULT_RECURSION_LIMIT- See Also:
-
-
Constructor Details
-
Parser
private Parser(TypeRegistry registry, JsonFormat.TypeRegistry oldRegistry, boolean ignoreUnknownFields, int recursionLimit)
-
-
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
-
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 proto3 JSON 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 proto3 JSON encoding into a protobuf message.- Throws:
InvalidProtocolBufferException- if the input is not valid proto3 JSON format or there are unknown fields in the inputIOException- if reading from the input throws
-
usingRecursionLimit
-