Stay organized with collections Save and categorize content based on your preferences.
The Field class is the base class for all fields defined on messages. This class cannot be extended by developers.
Field
is provided by the protorpc.messages
module.
The constructor of the Field class is defined as follows:
Initializes an Field instance. Each sub-class of Field must define the following:
VARIANTS
DEFAULT_VARIANT
repeated
argument; do not specify repeated
if you use required
.
required
argument; do not specify required=True
if you also use repeated=True
.
descriptor.proto
. Best practice is to use default values, but you can specify values as 32-bit, 64-bit, unsigned, etc.
Note: Default values are not permitted for repeated fields or message fields.
Raises the following exceptions:
The FieldList class has one property:
FieldList instances have the following methods:
Raises a ValidationError if the value is not an expected type.
Validates a value assigned to a default field. Specific to a single element.
Some fields may allow for delayed resolution of default types necessary in the case of circular definition references. In this case, the default value might be a placeholder that is resolved when needed after all the message classes are defined.
ArgumentsRaises a ValidationError if the value is not an expected type.
Validates that a field's default value.
ArgumentsRaises a ValidationError if the value is not an expected type.
Gets a message definition that contains this Field definition. Returns a definition for the Message object that contains the Field. Returns None if Field is defined outside of a message class.
Raises a ValidationError if the value is not an expected type.
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-08-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["The `Field` class serves as the foundation for all fields within messages and cannot be extended by developers, and is provided by the `protorpc.messages` module."],["The `Field` constructor takes parameters like `number`, `required`, `repeated`, `variant`, and `default` to define field properties, and raises exceptions for invalid inputs, such as an invalid default, or mutually exclusive arguments."],["The `Field` class contains `VARIANTS` and `DEFAULT_VARIANT` properties that define the field's acceptable variant types, and its default variant type respectively."],["The `Field` instance methods include `validate`, `validate_default_element`, `validate_default` to check values against expectations, and `message_definition` to find the `Message` that contains the Field."],["Default values for Fields are not permitted for repeated fields or message fields, as specified by the argument `default=None` in the constructor."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4