The Enum Class
Stay organized with collections
Save and categorize content based on your preferences.
The Enum class is the base class for all enumerated types, used to initialize new Enum instances.
Enum
is provided by the protorpc.messages
module.
Constructor
The constructor of the EnumField class is defined as follows:
- class Enum(name, number=None)
-
Initializes an Enum instance automatically when the class is constructed. Integers and strings are cast automatically to the enum values.
Arguments
- name
- The name of the Enum instance to initialize.
- number
- The number of the Enum instance to initialize.
Raises an exception if called on a class that has already been initialized.
Class Methods
The Enum class provides the following class methods:
- to_dict()
- Makes a dictionary version of enumerated class. You can use this dictionary with def_num and import_enum.
- Returns a dictionary name and number for the enumerated class.
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-01-28 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-01-28 UTC."],[],[]]