Package com.google.protobuf
Class TextFormat.Parser.Builder
java.lang.Object
com.google.protobuf.TextFormat.Parser.Builder
- Enclosing class:
- TextFormat.Parser
Builder that can be used to obtain new instances of
TextFormat.Parser.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate booleanprivate booleanprivate TextFormatParseInfoTree.Builderprivate intprivate TypeRegistry -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()setAllowUnknownExtensions(boolean allowUnknownExtensions) Set whether this parser will allow unknown extensions.setAllowUnknownFields(boolean allowUnknownFields) Set whether this parser will allow unknown fields.setParseInfoTreeBuilder(TextFormatParseInfoTree.Builder parseInfoTreeBuilder) setRecursionLimit(int recursionLimit) Set the maximum recursion limit that the parser will allow.Sets parser behavior when a non-repeated field appears more than once.setTypeRegistry(TypeRegistry typeRegistry) Sets the TypeRegistry for resolving Any.
-
Field Details
-
allowUnknownFields
private boolean allowUnknownFields -
allowUnknownEnumValues
private boolean allowUnknownEnumValues -
allowUnknownExtensions
private boolean allowUnknownExtensions -
singularOverwritePolicy
-
parseInfoTreeBuilder
-
typeRegistry
-
recursionLimit
private int recursionLimit
-
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
setTypeRegistry
Sets the TypeRegistry for resolving Any. If this is not set, TextFormat will not be able to parse Any unless Any is write as bytes.- Throws:
IllegalArgumentException- if a registry is already set.
-
setAllowUnknownFields
Set whether this parser will allow unknown fields. By default, an exception is thrown if an unknown field is encountered. If this is set, the parser will only log a warning. Allow unknown fields will also allow unknown extensions.Use of this parameter is discouraged which may hide some errors (e.g. spelling error on field name).
-
setAllowUnknownExtensions
Set whether this parser will allow unknown extensions. By default, an exception is thrown if unknown extension is encountered. If this is set true, the parser will only log a warning. Allow unknown extensions does not mean allow normal unknown fields. -
setSingularOverwritePolicy
public TextFormat.Parser.Builder setSingularOverwritePolicy(TextFormat.Parser.SingularOverwritePolicy p) Sets parser behavior when a non-repeated field appears more than once. -
setParseInfoTreeBuilder
public TextFormat.Parser.Builder setParseInfoTreeBuilder(TextFormatParseInfoTree.Builder parseInfoTreeBuilder) -
setRecursionLimit
Set the maximum recursion limit that the parser will allow. If the depth of the message exceeds this limit then the parser will stop and throw an exception. -
build
-