A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://cloud.google.com/appengine/docs/legacy/standard/python/tools/protorpc/messages/fieldclass below:

The Field Class | App Engine standard environment for Python 2

The Field Class

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.

Constructor

The constructor of the Field class is defined as follows:

class  Field (message_type, number, [required=False | repeated=False], variant=None, default=None)

Initializes an Field instance. Each sub-class of Field must define the following:

VARIANTS
Set of variant types accepted by that field.
DEFAULT_VARIANT
Default variant type if not specified in constructor.
Arguments
number
Number of the field. Must be unique per message class.
required=False
Whether or not this field is required. Mutually exclusive with the repeated argument; do not specify repeated if you use required.
repeated=False
Whether or not this field is repeated. Mutually exclusive with the required argument; do not specify required=True if you also use repeated=True.
variant=None
Provides additional encoding information that is mainly used by protocol buffers. These variants map to the Type values in descriptor.proto. Best practice is to use default values, but you can specify values as 32-bit, 64-bit, unsigned, etc.
default=None
Default value for the field if not found in the underlying request.

Note: Default values are not permitted for repeated fields or message fields.

Raises the following exceptions:

Class Property

The FieldList class has one property:

default()
The default value for the field.
Instance Methods

FieldList instances have the following methods:

validate(value)
Validates a value assigned to a field. Arguments
value
The value to evaluate.

Raises a ValidationError if the value is not an expected type.

validate_default_element(value)

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.

Arguments
value
Default value to validate.

Raises a ValidationError if the value is not an expected type.

validate_default(value)

Validates that a field's default value.

Arguments
value
Default value to validate.

Raises a ValidationError if the value is not an expected type.

message_definition()

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