Package dev.cel.checker
Class DescriptorTypeProvider
- java.lang.Object
-
- dev.cel.checker.DescriptorTypeProvider
-
- All Implemented Interfaces:
TypeProvider
@Immutable @Internal public class DescriptorTypeProvider extends java.lang.Object implements TypeProvider
TheDescriptorTypeProviderprovides type information for one or moreDescriptors.Descriptorinstances of proto messages.TODO: Unify implementation across the runtime (i.e: DescriptorMessageProvider) and the compilation. This class can likely be eliminated as part of the work.
CEL Library Internals. Do Not Use.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classDescriptorTypeProvider.EnumValueDefValue object for an enumDescriptorTypeProvider.EnumValueDef.name()andDescriptorTypeProvider.EnumValueDef.value().protected static classDescriptorTypeProvider.FieldDefValue object for a proto-based field definition.protected static classDescriptorTypeProvider.MapEntryDefValue object for Map entryTypeDefinformation.protected static classDescriptorTypeProvider.SymbolTableHelper class to construct a symbol table for messages, enums, and their respective declarations.protected static classDescriptorTypeProvider.TypeDefValue object for a proto-based primitive, message, or enum definition.-
Nested classes/interfaces inherited from interface dev.cel.checker.TypeProvider
TypeProvider.CombinedTypeProvider, TypeProvider.ExtensionFieldType, TypeProvider.FieldType
-
-
Constructor Summary
Constructors Constructor Description DescriptorTypeProvider()Constructs the empty provider, which will resolve nothing.DescriptorTypeProvider(DescriptorProtos.FileDescriptorSet descriptorSet)Constructs a provider based on the given file descriptor set proto, as it is emitted by the protocol compiler.DescriptorTypeProvider(java.lang.Iterable<Descriptors.Descriptor> descriptors)DescriptorTypeProvider(java.util.Collection<Descriptors.FileDescriptor> fileDescriptors)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable java.lang.IntegerlookupEnumValue(java.lang.String enumName)Lookup theIntegerenum value given anenumName.@Nullable TypeProvider.ExtensionFieldTypelookupExtensionType(java.lang.String extensionName)Lookup theFieldTypeof the named extension (specified using its full path).@Nullable com.google.common.collect.ImmutableSet<java.lang.String>lookupFieldNames(Type type)Returns the field names associated with the givenType.@Nullable TypeProvider.FieldTypelookupFieldType(Type type, java.lang.String fieldName)Lookup theFieldTypefor afieldNamewithin atype.@Nullable TypelookupType(java.lang.String typeName)Lookup the aTypegiven a qualifiedtypeName.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface dev.cel.checker.TypeProvider
lookupCelType, lookupFieldType
-
-
-
-
Constructor Detail
-
DescriptorTypeProvider
public DescriptorTypeProvider()
Constructs the empty provider, which will resolve nothing.
-
DescriptorTypeProvider
public DescriptorTypeProvider(DescriptorProtos.FileDescriptorSet descriptorSet)
Constructs a provider based on the given file descriptor set proto, as it is emitted by the protocol compiler.
-
DescriptorTypeProvider
public DescriptorTypeProvider(java.util.Collection<Descriptors.FileDescriptor> fileDescriptors)
-
DescriptorTypeProvider
public DescriptorTypeProvider(java.lang.Iterable<Descriptors.Descriptor> descriptors)
-
-
Method Detail
-
lookupType
public @Nullable Type lookupType(java.lang.String typeName)
Description copied from interface:TypeProviderLookup the aTypegiven a qualifiedtypeName. Returns null if not found.- Specified by:
lookupTypein interfaceTypeProvider
-
lookupEnumValue
public @Nullable java.lang.Integer lookupEnumValue(java.lang.String enumName)
Description copied from interface:TypeProviderLookup theIntegerenum value given anenumName. Returns null if not found.- Specified by:
lookupEnumValuein interfaceTypeProvider
-
lookupFieldType
public @Nullable TypeProvider.FieldType lookupFieldType(Type type, java.lang.String fieldName)
Description copied from interface:TypeProviderLookup theFieldTypefor afieldNamewithin atype. Returns null if not found.The
FieldTypereturn value will indicate the type of the field and whether presence check is supported via the ('has') macro.- Specified by:
lookupFieldTypein interfaceTypeProvider
-
lookupFieldNames
public @Nullable com.google.common.collect.ImmutableSet<java.lang.String> lookupFieldNames(Type type)
Description copied from interface:TypeProviderReturns the field names associated with the givenType.If the type is not a message type, or the type is not found, the result is
null.- Specified by:
lookupFieldNamesin interfaceTypeProvider
-
lookupExtensionType
public @Nullable TypeProvider.ExtensionFieldType lookupExtensionType(java.lang.String extensionName)
Description copied from interface:TypeProviderLookup theFieldTypeof the named extension (specified using its full path). Returns null if not found.- Specified by:
lookupExtensionTypein interfaceTypeProvider
-
-