Class TextFormat.Parser.Builder (3.19.4)
public static class TextFormat.Parser.Builder
Builder that can be used to obtain new instances of Parser.
Constructors
Builder()
Methods
build()
public TextFormat.Parser build()
setAllowUnknownExtensions(boolean allowUnknownExtensions)
public TextFormat.Parser.Builder setAllowUnknownExtensions(boolean allowUnknownExtensions)
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.
| Parameter |
| Name |
Description |
allowUnknownExtensions |
boolean
|
setAllowUnknownFields(boolean allowUnknownFields)
public TextFormat.Parser.Builder setAllowUnknownFields(boolean allowUnknownFields)
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).
| Parameter |
| Name |
Description |
allowUnknownFields |
boolean
|
setParseInfoTreeBuilder(TextFormatParseInfoTree.Builder parseInfoTreeBuilder)
public TextFormat.Parser.Builder setParseInfoTreeBuilder(TextFormatParseInfoTree.Builder parseInfoTreeBuilder)
setSingularOverwritePolicy(TextFormat.Parser.SingularOverwritePolicy p)
public TextFormat.Parser.Builder setSingularOverwritePolicy(TextFormat.Parser.SingularOverwritePolicy p)
Sets parser behavior when a non-repeated field appears more than once.
setTypeRegistry(TypeRegistry typeRegistry)
public TextFormat.Parser.Builder setTypeRegistry(TypeRegistry typeRegistry)
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.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-10-30 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-10-30 UTC."],[],[]]