DescriptorLibrary Functions
Stay organized with collections
Save and categorize content based on your preferences.
A descriptor library is an object that contains known definitions. It contains a cache of descriptor objects mapped by definition name, and contains all types of descriptors except for file sets.
If the application provides a definition name that is not in the library, the application can include a descriptor loader that attempts to resolve the missing descriptor.
DescriptorLibrary is provided by the protorpc.descriptor
module.
Functions
DescriptorLibrary provides the following functions:
- lookup_descriptor(definition_name)
-
Gets a descriptor from the library for the given definition name. If the descriptor is not found, attempts to find it using the descriptor loader.
Arguments
- definition_name
- The definition name for which to find a descriptor.
Returns a descriptor describing the definition name.
Raises a DefinitionNotFoundError error if no descriptor exists for the given definition name.
- lookup_package(definition_name)
-
Determines the package name that any definition name belongs to. May check the parent for the package name. Attempts to resolve missing descriptors if provided a descriptor loader.
Arguments
- definition_name
- The definition name for which to find a package.
Returns a descriptor object describing the package name.
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-03-05 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-03-05 UTC."],[[["Descriptor libraries are objects that store known definitions, caching descriptor objects by their definition name and including all descriptor types except file sets."],["They can utilize a descriptor loader to resolve definition names not initially found within the library."],["The `lookup_descriptor` function retrieves a descriptor by definition name, using the descriptor loader if needed, and raises a `DefinitionNotFoundError` if unsuccessful."],["The `lookup_package` function identifies the package a given definition name belongs to, possibly checking parent packages, and can employ a descriptor loader for missing definitions."]]],[]]