Package com.google.protobuf
Class Descriptors.DescriptorPool
java.lang.Object
com.google.protobuf.Descriptors.DescriptorPool
- Enclosing class:
Descriptors
A private helper class which contains lookup tables containing all the descriptors defined in a
particular file.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
Represents a package in the symbol table.(package private) static enum
Defines what subclass of descriptors to search in the descriptor pool. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final boolean
private final Set
<Descriptors.FileDescriptor> private final Map
<String, Descriptors.GenericDescriptor> -
Constructor Summary
ConstructorsConstructorDescriptionDescriptorPool
(Descriptors.FileDescriptor[] dependencies, boolean allowUnknownDependencies) -
Method Summary
Modifier and TypeMethodDescription(package private) void
addPackage
(String fullName, Descriptors.FileDescriptor file) Adds a package to the symbol tables.(package private) void
addSymbol
(Descriptors.GenericDescriptor descriptor) Adds a symbol to the symbol table.(package private) Descriptors.GenericDescriptor
findSymbol
(String fullName) Find a generic descriptor by fully-qualified name.(package private) Descriptors.GenericDescriptor
findSymbol
(String fullName, Descriptors.DescriptorPool.SearchFilter filter) Find a descriptor by fully-qualified name and given option to only search valid field type descriptors.private void
Find and put public dependencies of the file into dependencies set.(package private) boolean
isAggregate
(Descriptors.GenericDescriptor descriptor) Checks if the descriptor is a valid namespace type.(package private) boolean
isType
(Descriptors.GenericDescriptor descriptor) Checks if the descriptor is a valid type for a message field.(package private) Descriptors.GenericDescriptor
lookupSymbol
(String name, Descriptors.GenericDescriptor relativeTo, Descriptors.DescriptorPool.SearchFilter filter) Look up a type descriptor by name, relative to some other descriptor.(package private) static void
validateSymbolName
(Descriptors.GenericDescriptor descriptor) Verifies that the descriptor's name is valid.
-
Field Details
-
dependencies
-
allowUnknownDependencies
private final boolean allowUnknownDependencies -
descriptorsByName
-
-
Constructor Details
-
DescriptorPool
DescriptorPool(Descriptors.FileDescriptor[] dependencies, boolean allowUnknownDependencies)
-
-
Method Details
-
importPublicDependencies
Find and put public dependencies of the file into dependencies set. -
findSymbol
Find a generic descriptor by fully-qualified name. -
findSymbol
Descriptors.GenericDescriptor findSymbol(String fullName, Descriptors.DescriptorPool.SearchFilter filter) Find a descriptor by fully-qualified name and given option to only search valid field type descriptors. -
isType
Checks if the descriptor is a valid type for a message field. -
isAggregate
Checks if the descriptor is a valid namespace type. -
lookupSymbol
Descriptors.GenericDescriptor lookupSymbol(String name, Descriptors.GenericDescriptor relativeTo, Descriptors.DescriptorPool.SearchFilter filter) throws Descriptors.DescriptorValidationException Look up a type descriptor by name, relative to some other descriptor. The name may be fully-qualified (with a leading '.'), partially-qualified, or unqualified. C++-like name lookup semantics are used to search for the matching descriptor. -
addSymbol
void addSymbol(Descriptors.GenericDescriptor descriptor) throws Descriptors.DescriptorValidationException Adds a symbol to the symbol table. If a symbol with the same name already exists, throws an error. -
addPackage
void addPackage(String fullName, Descriptors.FileDescriptor file) throws Descriptors.DescriptorValidationException Adds a package to the symbol tables. If a package by the same name already exists, that is fine, but if some other kind of symbol exists under the same name, an exception is thrown. If the package has multiple components, this also adds the parent package(s). -
validateSymbolName
static void validateSymbolName(Descriptors.GenericDescriptor descriptor) throws Descriptors.DescriptorValidationException Verifies that the descriptor's name is valid. That is, it contains only letters, digits, and underscores, and does not start with a digit.
-