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(Decl... declarations)Add variable and functiondeclarationsto the CEL environment.CelCheckerBuilderaddDeclarations(java.lang.Iterable<Decl> declarations)Add variable and functiondeclarationsto the CEL environment.CelCheckerBuilderaddFileTypes(DescriptorProtos.FileDescriptorSet fileDescriptorSet)Add all of theDescriptors.FileDescriptors in aFileDescriptorSetto the use for type-checking, and for object creation at interpretation time.CelCheckerBuilderaddFileTypes(Descriptors.FileDescriptor... fileDescriptors)AddDescriptors.FileDescriptors to the use for type-checking, and for object creation at interpretation time.CelCheckerBuilderaddFileTypes(java.lang.Iterable<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(Descriptors.Descriptor... descriptors)Add messageDescriptors.Descriptors to the use for type-checking and object creation at interpretation time.CelCheckerBuilderaddMessageTypes(java.lang.Iterable<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.CelCheckerBuildersetContainer(java.lang.String container)Set thecontainername to use as the namespace for resolving CEL expression variables and functions.CelCheckerBuildersetOptions(CelOptions options)Set theCelOptionsused to enable fixes and features for this CEL instances.CelCheckerBuildersetProtoResultType(Type resultType)Set the expectedresultTypein proto format described in checked.proto for the type-checked expression.CelCheckerBuildersetResultType(CelType resultType)Set the expectedresultTypefor the type-checked expression.CelCheckerBuildersetStandardEnvironmentEnabled(boolean value)Enable or disable the standard CEL library functions and variablesCelCheckerBuildersetTypeProvider(TypeProvider celTypeProvider)Deprecated.UsesetTypeProvider(CelTypeProvider)instead.CelCheckerBuildersetTypeProvider(CelTypeProvider celTypeProvider)Set thecelTypeProviderfor use with type-checking expressions.
-
-
-
Method Detail
-
setOptions
@CanIgnoreReturnValue CelCheckerBuilder setOptions(CelOptions options)
Set theCelOptionsused to enable fixes and features for this CEL instances.
-
setContainer
@CanIgnoreReturnValue CelCheckerBuilder setContainer(java.lang.String container)
Set thecontainername to use as the namespace for resolving CEL expression variables and functions.
-
addDeclarations
@CanIgnoreReturnValue CelCheckerBuilder addDeclarations(Decl... declarations)
Add variable and functiondeclarationsto the CEL environment.
-
addDeclarations
@CanIgnoreReturnValue CelCheckerBuilder addDeclarations(java.lang.Iterable<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(CelType resultType)
Set the expectedresultTypefor the type-checked expression.
-
setProtoResultType
@CanIgnoreReturnValue CelCheckerBuilder setProtoResultType(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(CelTypeProvider celTypeProvider)
Set thecelTypeProviderfor use with type-checking expressions.
-
addMessageTypes
@CanIgnoreReturnValue CelCheckerBuilder addMessageTypes(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<Descriptors.Descriptor> descriptors)
Add messageDescriptors.Descriptors to the use for type-checking and object creation at interpretation time.
-
addFileTypes
@CanIgnoreReturnValue CelCheckerBuilder addFileTypes(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<Descriptors.FileDescriptor> fileDescriptors)
AddDescriptors.FileDescriptors to the use for type-checking, and for object creation at interpretation time.
-
addFileTypes
@CanIgnoreReturnValue CelCheckerBuilder addFileTypes(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
-
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.
-
-