Package dev.cel.checker
Interface CelCheckerBuilder
-
- All Known Implementing Classes:
CelCheckerLegacyImpl.Builder
public interface CelCheckerBuilderInterface for building an instance of CelChecker
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description CelCheckerBuilderaddDeclarations(dev.cel.expr.Decl... declarations)Add variable and functiondeclarationsto the CEL environment.CelCheckerBuilderaddDeclarations(java.lang.Iterable<dev.cel.expr.Decl> declarations)Add variable and functiondeclarationsto the CEL environment.CelCheckerBuilderaddFileTypes(com.google.protobuf.DescriptorProtos.FileDescriptorSet fileDescriptorSet)Add all of theDescriptors.FileDescriptors in aFileDescriptorSetto the use for type-checking, and for object creation at interpretation time.CelCheckerBuilderaddFileTypes(com.google.protobuf.Descriptors.FileDescriptor... fileDescriptors)AddDescriptors.FileDescriptors to the use for type-checking, and for object creation at interpretation time.CelCheckerBuilderaddFileTypes(java.lang.Iterable<com.google.protobuf.Descriptors.FileDescriptor> fileDescriptors)AddDescriptors.FileDescriptors to the use for type-checking, and for object creation at interpretation time.CelCheckerBuilderaddFunctionDeclarations(CelFunctionDecl... celFunctionDecls)Add function declarationCelFunctionDeclto the CEL environment.CelCheckerBuilderaddFunctionDeclarations(java.lang.Iterable<CelFunctionDecl> celFunctionDecls)Add function declarationCelFunctionDeclto the CEL environment.CelCheckerBuilderaddLibraries(CelCheckerLibrary... libraries)Adds one or more libraries for parsing and type-checking.CelCheckerBuilderaddLibraries(java.lang.Iterable<? extends CelCheckerLibrary> libraries)Adds a collection of libraries for parsing and type-checking.CelCheckerBuilderaddMessageTypes(com.google.protobuf.Descriptors.Descriptor... descriptors)Add messageDescriptors.Descriptors to the use for type-checking and object creation at interpretation time.CelCheckerBuilderaddMessageTypes(java.lang.Iterable<com.google.protobuf.Descriptors.Descriptor> descriptors)Add messageDescriptors.Descriptors to the use for type-checking and object creation at interpretation time.CelCheckerBuilderaddProtoTypeMasks(ProtoTypeMask... typeMasks)Add one or moreProtoTypeMaskvalues.CelCheckerBuilderaddProtoTypeMasks(java.lang.Iterable<ProtoTypeMask> typeMasks)Add one or moreProtoTypeMaskvalues.CelCheckerBuilderaddVarDeclarations(CelVarDecl... celVarDecls)Add variable declarationCelVarDeclto the CEL environment.CelCheckerBuilderaddVarDeclarations(java.lang.Iterable<CelVarDecl> celVarDecls)Add variable declarationCelVarDeclto the CEL environment.CelCheckerbuild()Build a new instance of theCelChecker.dev.cel.common.CelContainercontainer()Retrieves the currently configuredCelContainerin the builder.dev.cel.common.CelOptionsoptions()Retrieves the currently configuredCelOptionsin the builder.CelCheckerBuildersetContainer(dev.cel.common.CelContainer container)Set theCelContainerto use as the namespace for resolving CEL expression variables and functions.CelCheckerBuildersetOptions(dev.cel.common.CelOptions options)Set theCelOptionsused to enable fixes and features for this CEL instances.CelCheckerBuildersetProtoResultType(dev.cel.expr.Type resultType)Set the expectedresultTypein proto format described in checked.proto for the type-checked expression.CelCheckerBuildersetResultType(dev.cel.common.types.CelType resultType)Set the expectedresultTypefor the type-checked expression.CelCheckerBuildersetStandardDeclarations(CelStandardDeclarations standardDeclarations)Override the standard declarations for the type-checker.CelCheckerBuildersetStandardEnvironmentEnabled(boolean value)Enable or disable the standard CEL library functions and variablesCelCheckerBuildersetTypeProvider(TypeProvider celTypeProvider)Deprecated.UsesetTypeProvider(CelTypeProvider)instead.CelCheckerBuildersetTypeProvider(dev.cel.common.types.CelTypeProvider celTypeProvider)Set thecelTypeProviderfor use with type-checking expressions.
-
-
-
Method Detail
-
setOptions
@CanIgnoreReturnValue CelCheckerBuilder setOptions(dev.cel.common.CelOptions options)
Set theCelOptionsused to enable fixes and features for this CEL instances.
-
options
dev.cel.common.CelOptions options()
Retrieves the currently configuredCelOptionsin the builder.
-
setContainer
@CanIgnoreReturnValue CelCheckerBuilder setContainer(dev.cel.common.CelContainer container)
Set theCelContainerto use as the namespace for resolving CEL expression variables and functions.
-
container
dev.cel.common.CelContainer container()
Retrieves the currently configuredCelContainerin the builder.
-
addDeclarations
@CanIgnoreReturnValue CelCheckerBuilder addDeclarations(dev.cel.expr.Decl... declarations)
Add variable and functiondeclarationsto the CEL environment.
-
addDeclarations
@CanIgnoreReturnValue CelCheckerBuilder addDeclarations(java.lang.Iterable<dev.cel.expr.Decl> declarations)
Add variable and functiondeclarationsto the CEL environment.
-
addFunctionDeclarations
@CanIgnoreReturnValue CelCheckerBuilder addFunctionDeclarations(CelFunctionDecl... celFunctionDecls)
Add function declarationCelFunctionDeclto the CEL environment.
-
addFunctionDeclarations
@CanIgnoreReturnValue CelCheckerBuilder addFunctionDeclarations(java.lang.Iterable<CelFunctionDecl> celFunctionDecls)
Add function declarationCelFunctionDeclto the CEL environment.
-
addVarDeclarations
@CanIgnoreReturnValue CelCheckerBuilder addVarDeclarations(CelVarDecl... celVarDecls)
Add variable declarationCelVarDeclto the CEL environment.
-
addVarDeclarations
@CanIgnoreReturnValue CelCheckerBuilder addVarDeclarations(java.lang.Iterable<CelVarDecl> celVarDecls)
Add variable declarationCelVarDeclto the CEL environment.
-
addProtoTypeMasks
@CanIgnoreReturnValue CelCheckerBuilder addProtoTypeMasks(ProtoTypeMask... typeMasks)
Add one or moreProtoTypeMaskvalues. TheProtoTypeMaskvalues will be used to compute a set ofDeclvalues using a protobuf message's fields as the names and types of the variables ifProtoTypeMask.fieldsAreVariableDeclarations()istrue.Note, this feature may not work with custom
TypeProviderimplementations out of the box, as it requires the implementation ofTypeProvider.lookupFieldNames(dev.cel.expr.Type)to return the set of all fields declared on the protobuf type.
-
addProtoTypeMasks
@CanIgnoreReturnValue CelCheckerBuilder addProtoTypeMasks(java.lang.Iterable<ProtoTypeMask> typeMasks)
Add one or moreProtoTypeMaskvalues. TheProtoTypeMaskvalues will be used to compute a set ofDeclvalues using a protobuf message's fields as the names and types of the variables ifProtoTypeMask.fieldsAreVariableDeclarations()istrue.Note, this feature may not work with custom
TypeProviderimplementations out of the box, as it requires the implementation ofTypeProvider.lookupFieldNames(dev.cel.expr.Type)to return the set of all fields declared on the protobuf type.
-
setResultType
@CanIgnoreReturnValue CelCheckerBuilder setResultType(dev.cel.common.types.CelType resultType)
Set the expectedresultTypefor the type-checked expression.
-
setProtoResultType
@CanIgnoreReturnValue CelCheckerBuilder setProtoResultType(dev.cel.expr.Type resultType)
Set the expectedresultTypein proto format described in checked.proto for the type-checked expression.
-
setTypeProvider
@CanIgnoreReturnValue @Deprecated CelCheckerBuilder setTypeProvider(TypeProvider celTypeProvider)
Deprecated.UsesetTypeProvider(CelTypeProvider)instead.Set thetypeProviderfor use with type-checking expressions.
-
setTypeProvider
@CanIgnoreReturnValue CelCheckerBuilder setTypeProvider(dev.cel.common.types.CelTypeProvider celTypeProvider)
Set thecelTypeProviderfor use with type-checking expressions.
-
addMessageTypes
@CanIgnoreReturnValue CelCheckerBuilder addMessageTypes(com.google.protobuf.Descriptors.Descriptor... descriptors)
Add messageDescriptors.Descriptors to the use for type-checking and object creation at interpretation time.
-
addMessageTypes
@CanIgnoreReturnValue CelCheckerBuilder addMessageTypes(java.lang.Iterable<com.google.protobuf.Descriptors.Descriptor> descriptors)
Add messageDescriptors.Descriptors to the use for type-checking and object creation at interpretation time.
-
addFileTypes
@CanIgnoreReturnValue CelCheckerBuilder addFileTypes(com.google.protobuf.Descriptors.FileDescriptor... fileDescriptors)
AddDescriptors.FileDescriptors to the use for type-checking, and for object creation at interpretation time.
-
addFileTypes
@CanIgnoreReturnValue CelCheckerBuilder addFileTypes(java.lang.Iterable<com.google.protobuf.Descriptors.FileDescriptor> fileDescriptors)
AddDescriptors.FileDescriptors to the use for type-checking, and for object creation at interpretation time.
-
addFileTypes
@CanIgnoreReturnValue CelCheckerBuilder addFileTypes(com.google.protobuf.DescriptorProtos.FileDescriptorSet fileDescriptorSet)
Add all of theDescriptors.FileDescriptors in aFileDescriptorSetto the use for type-checking, and for object creation at interpretation time.
-
setStandardEnvironmentEnabled
@CanIgnoreReturnValue CelCheckerBuilder setStandardEnvironmentEnabled(boolean value)
Enable or disable the standard CEL library functions and variables
-
setStandardDeclarations
@CanIgnoreReturnValue CelCheckerBuilder setStandardDeclarations(CelStandardDeclarations standardDeclarations)
Override the standard declarations for the type-checker. This can be used to subset the standard environment to only expose the desired declarations to the type-checker.setStandardEnvironmentEnabled(boolean)must be set to false for this to take effect.
-
addLibraries
@CanIgnoreReturnValue CelCheckerBuilder addLibraries(CelCheckerLibrary... libraries)
Adds one or more libraries for parsing and type-checking.
-
addLibraries
@CanIgnoreReturnValue CelCheckerBuilder addLibraries(java.lang.Iterable<? extends CelCheckerLibrary> libraries)
Adds a collection of libraries for parsing and type-checking.
-
build
@CheckReturnValue CelChecker build()
Build a new instance of theCelChecker.
-
-