Package com.google.protobuf
Class Descriptors.DescriptorPool
- java.lang.Object
-
- com.google.protobuf.Descriptors.DescriptorPool
-
- Enclosing class:
- Descriptors
private static final class Descriptors.DescriptorPool extends java.lang.ObjectA private helper class which contains lookup tables containing all the descriptors defined in a particular file.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classDescriptors.DescriptorPool.PackageDescriptorRepresents a package in the symbol table.(package private) static classDescriptors.DescriptorPool.SearchFilterDefines what subclass of descriptors to search in the descriptor pool.
-
Field Summary
Fields Modifier and Type Field Description private booleanallowUnknownDependenciesprivate java.util.Set<Descriptors.FileDescriptor>dependenciesprivate java.util.Map<java.lang.String,Descriptors.GenericDescriptor>descriptorsByName
-
Constructor Summary
Constructors Constructor Description DescriptorPool(Descriptors.FileDescriptor[] dependencies, boolean allowUnknownDependencies)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidaddPackage(java.lang.String fullName, Descriptors.FileDescriptor file)Adds a package to the symbol tables.(package private) voidaddSymbol(Descriptors.GenericDescriptor descriptor)Adds a symbol to the symbol table.(package private) Descriptors.GenericDescriptorfindSymbol(java.lang.String fullName)Find a generic descriptor by fully-qualified name.(package private) Descriptors.GenericDescriptorfindSymbol(java.lang.String fullName, Descriptors.DescriptorPool.SearchFilter filter)Find a descriptor by fully-qualified name and given option to only search valid field type descriptors.private voidimportPublicDependencies(Descriptors.FileDescriptor file)Find and put public dependencies of the file into dependencies set.(package private) booleanisAggregate(Descriptors.GenericDescriptor descriptor)Checks if the descriptor is a valid namespace type.(package private) booleanisType(Descriptors.GenericDescriptor descriptor)Checks if the descriptor is a valid type for a message field.(package private) Descriptors.GenericDescriptorlookupSymbol(java.lang.String name, Descriptors.GenericDescriptor relativeTo, Descriptors.DescriptorPool.SearchFilter filter)Look up a type descriptor by name, relative to some other descriptor.(package private) static voidvalidateSymbolName(Descriptors.GenericDescriptor descriptor)Verifies that the descriptor's name is valid.
-
-
-
Field Detail
-
dependencies
private final java.util.Set<Descriptors.FileDescriptor> dependencies
-
allowUnknownDependencies
private final boolean allowUnknownDependencies
-
descriptorsByName
private final java.util.Map<java.lang.String,Descriptors.GenericDescriptor> descriptorsByName
-
-
Constructor Detail
-
DescriptorPool
DescriptorPool(Descriptors.FileDescriptor[] dependencies, boolean allowUnknownDependencies)
-
-
Method Detail
-
importPublicDependencies
private void importPublicDependencies(Descriptors.FileDescriptor file)
Find and put public dependencies of the file into dependencies set.
-
findSymbol
Descriptors.GenericDescriptor findSymbol(java.lang.String fullName)
Find a generic descriptor by fully-qualified name.
-
findSymbol
Descriptors.GenericDescriptor findSymbol(java.lang.String fullName, Descriptors.DescriptorPool.SearchFilter filter)
Find a descriptor by fully-qualified name and given option to only search valid field type descriptors.
-
isType
boolean isType(Descriptors.GenericDescriptor descriptor)
Checks if the descriptor is a valid type for a message field.
-
isAggregate
boolean isAggregate(Descriptors.GenericDescriptor descriptor)
Checks if the descriptor is a valid namespace type.
-
lookupSymbol
Descriptors.GenericDescriptor lookupSymbol(java.lang.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(java.lang.String fullName, Descriptors.FileDescriptor file) throws Descriptors.DescriptorValidationExceptionAdds 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.
-
-