Package dev.cel.checker
Class CelCheckerLegacyImpl.Builder
- java.lang.Object
-
- dev.cel.checker.CelCheckerLegacyImpl.Builder
-
- All Implemented Interfaces:
CelCheckerBuilder
- Enclosing class:
- CelCheckerLegacyImpl
public static final class CelCheckerLegacyImpl.Builder extends java.lang.Object implements CelCheckerBuilder
Builder class for the legacyCelCheckerimplementation.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description CelCheckerLegacyImpl.BuilderaddDeclarations(Decl... declarations)Add variable and functiondeclarationsto the CEL environment.CelCheckerLegacyImpl.BuilderaddDeclarations(java.lang.Iterable<Decl> declarations)Add variable and functiondeclarationsto the CEL environment.CelCheckerLegacyImpl.BuilderaddFileTypes(DescriptorProtos.FileDescriptorSet fileDescriptorSet)Add all of theDescriptors.FileDescriptors in aFileDescriptorSetto the use for type-checking, and for object creation at interpretation time.CelCheckerLegacyImpl.BuilderaddFileTypes(Descriptors.FileDescriptor... fileDescriptors)AddDescriptors.FileDescriptors to the use for type-checking, and for object creation at interpretation time.CelCheckerLegacyImpl.BuilderaddFileTypes(java.lang.Iterable<Descriptors.FileDescriptor> fileDescriptors)AddDescriptors.FileDescriptors to the use for type-checking, and for object creation at interpretation time.CelCheckerLegacyImpl.BuilderaddFunctionDeclarations(CelFunctionDecl... celFunctionDecls)Add function declarationCelFunctionDeclto the CEL environment.CelCheckerLegacyImpl.BuilderaddFunctionDeclarations(java.lang.Iterable<CelFunctionDecl> celFunctionDecls)Add function declarationCelFunctionDeclto the CEL environment.CelCheckerLegacyImpl.BuilderaddLibraries(CelCheckerLibrary... libraries)Adds one or more libraries for parsing and type-checking.CelCheckerLegacyImpl.BuilderaddLibraries(java.lang.Iterable<? extends CelCheckerLibrary> libraries)Adds a collection of libraries for parsing and type-checking.CelCheckerLegacyImpl.BuilderaddMessageTypes(Descriptors.Descriptor... descriptors)Add messageDescriptors.Descriptors to the use for type-checking and object creation at interpretation time.CelCheckerLegacyImpl.BuilderaddMessageTypes(java.lang.Iterable<Descriptors.Descriptor> descriptors)Add messageDescriptors.Descriptors to the use for type-checking and object creation at interpretation time.CelCheckerLegacyImpl.BuilderaddProtoTypeMasks(ProtoTypeMask... typeMasks)Add one or moreProtoTypeMaskvalues.CelCheckerLegacyImpl.BuilderaddProtoTypeMasks(java.lang.Iterable<ProtoTypeMask> typeMasks)Add one or moreProtoTypeMaskvalues.CelCheckerLegacyImpl.BuilderaddVarDeclarations(CelVarDecl... celVarDecls)Add variable declarationCelVarDeclto the CEL environment.CelCheckerLegacyImpl.BuilderaddVarDeclarations(java.lang.Iterable<CelVarDecl> celVarDecls)Add variable declarationCelVarDeclto the CEL environment.CelCheckerLegacyImplbuild()Build a new instance of theCelChecker.CelCheckerLegacyImpl.BuildersetContainer(java.lang.String container)Set thecontainername to use as the namespace for resolving CEL expression variables and functions.CelCheckerLegacyImpl.BuildersetOptions(CelOptions celOptions)Set theCelOptionsused to enable fixes and features for this CEL instances.CelCheckerLegacyImpl.BuildersetProtoResultType(Type resultType)Set the expectedresultTypein proto format described in checked.proto for the type-checked expression.CelCheckerLegacyImpl.BuildersetResultType(CelType resultType)Set the expectedresultTypefor the type-checked expression.CelCheckerLegacyImpl.BuildersetStandardEnvironmentEnabled(boolean value)Enable or disable the standard CEL library functions and variablesCelCheckerLegacyImpl.BuildersetTypeProvider(TypeProvider typeProvider)Deprecated.CelCheckerLegacyImpl.BuildersetTypeProvider(CelTypeProvider celTypeProvider)Set thecelTypeProviderfor use with type-checking expressions.
-
-
-
Method Detail
-
setOptions
@CanIgnoreReturnValue public CelCheckerLegacyImpl.Builder setOptions(CelOptions celOptions)
Set theCelOptionsused to enable fixes and features for this CEL instances.- Specified by:
setOptionsin interfaceCelCheckerBuilder
-
setContainer
@CanIgnoreReturnValue public CelCheckerLegacyImpl.Builder setContainer(java.lang.String container)
Set thecontainername to use as the namespace for resolving CEL expression variables and functions.- Specified by:
setContainerin interfaceCelCheckerBuilder
-
addDeclarations
@CanIgnoreReturnValue public CelCheckerLegacyImpl.Builder addDeclarations(Decl... declarations)
Add variable and functiondeclarationsto the CEL environment.- Specified by:
addDeclarationsin interfaceCelCheckerBuilder
-
addDeclarations
@CanIgnoreReturnValue public CelCheckerLegacyImpl.Builder addDeclarations(java.lang.Iterable<Decl> declarations)
Add variable and functiondeclarationsto the CEL environment.- Specified by:
addDeclarationsin interfaceCelCheckerBuilder
-
addFunctionDeclarations
@CanIgnoreReturnValue public CelCheckerLegacyImpl.Builder addFunctionDeclarations(CelFunctionDecl... celFunctionDecls)
Add function declarationCelFunctionDeclto the CEL environment.- Specified by:
addFunctionDeclarationsin interfaceCelCheckerBuilder
-
addFunctionDeclarations
@CanIgnoreReturnValue public CelCheckerLegacyImpl.Builder addFunctionDeclarations(java.lang.Iterable<CelFunctionDecl> celFunctionDecls)
Add function declarationCelFunctionDeclto the CEL environment.- Specified by:
addFunctionDeclarationsin interfaceCelCheckerBuilder
-
addVarDeclarations
@CanIgnoreReturnValue public CelCheckerLegacyImpl.Builder addVarDeclarations(CelVarDecl... celVarDecls)
Add variable declarationCelVarDeclto the CEL environment.- Specified by:
addVarDeclarationsin interfaceCelCheckerBuilder
-
addVarDeclarations
@CanIgnoreReturnValue public CelCheckerLegacyImpl.Builder addVarDeclarations(java.lang.Iterable<CelVarDecl> celVarDecls)
Add variable declarationCelVarDeclto the CEL environment.- Specified by:
addVarDeclarationsin interfaceCelCheckerBuilder
-
addProtoTypeMasks
@CanIgnoreReturnValue public CelCheckerLegacyImpl.Builder 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.- Specified by:
addProtoTypeMasksin interfaceCelCheckerBuilder
-
addProtoTypeMasks
@CanIgnoreReturnValue public CelCheckerLegacyImpl.Builder 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.- Specified by:
addProtoTypeMasksin interfaceCelCheckerBuilder
-
setResultType
@CanIgnoreReturnValue public CelCheckerLegacyImpl.Builder setResultType(CelType resultType)
Set the expectedresultTypefor the type-checked expression.- Specified by:
setResultTypein interfaceCelCheckerBuilder
-
setProtoResultType
@CanIgnoreReturnValue public CelCheckerLegacyImpl.Builder setProtoResultType(Type resultType)
Set the expectedresultTypein proto format described in checked.proto for the type-checked expression.- Specified by:
setProtoResultTypein interfaceCelCheckerBuilder
-
setTypeProvider
@CanIgnoreReturnValue @Deprecated public CelCheckerLegacyImpl.Builder setTypeProvider(TypeProvider typeProvider)
Deprecated.Set thetypeProviderfor use with type-checking expressions.- Specified by:
setTypeProviderin interfaceCelCheckerBuilder
-
setTypeProvider
@CanIgnoreReturnValue public CelCheckerLegacyImpl.Builder setTypeProvider(CelTypeProvider celTypeProvider)
Set thecelTypeProviderfor use with type-checking expressions.- Specified by:
setTypeProviderin interfaceCelCheckerBuilder
-
addMessageTypes
@CanIgnoreReturnValue public CelCheckerLegacyImpl.Builder addMessageTypes(Descriptors.Descriptor... descriptors)
Add messageDescriptors.Descriptors to the use for type-checking and object creation at interpretation time.- Specified by:
addMessageTypesin interfaceCelCheckerBuilder
-
addMessageTypes
@CanIgnoreReturnValue public CelCheckerLegacyImpl.Builder addMessageTypes(java.lang.Iterable<Descriptors.Descriptor> descriptors)
Add messageDescriptors.Descriptors to the use for type-checking and object creation at interpretation time.- Specified by:
addMessageTypesin interfaceCelCheckerBuilder
-
addFileTypes
@CanIgnoreReturnValue public CelCheckerLegacyImpl.Builder addFileTypes(Descriptors.FileDescriptor... fileDescriptors)
AddDescriptors.FileDescriptors to the use for type-checking, and for object creation at interpretation time.- Specified by:
addFileTypesin interfaceCelCheckerBuilder
-
addFileTypes
@CanIgnoreReturnValue public CelCheckerLegacyImpl.Builder addFileTypes(java.lang.Iterable<Descriptors.FileDescriptor> fileDescriptors)
AddDescriptors.FileDescriptors to the use for type-checking, and for object creation at interpretation time.- Specified by:
addFileTypesin interfaceCelCheckerBuilder
-
addFileTypes
@CanIgnoreReturnValue public CelCheckerLegacyImpl.Builder addFileTypes(DescriptorProtos.FileDescriptorSet fileDescriptorSet)
Add all of theDescriptors.FileDescriptors in aFileDescriptorSetto the use for type-checking, and for object creation at interpretation time.- Specified by:
addFileTypesin interfaceCelCheckerBuilder
-
setStandardEnvironmentEnabled
@CanIgnoreReturnValue public CelCheckerLegacyImpl.Builder setStandardEnvironmentEnabled(boolean value)
Enable or disable the standard CEL library functions and variables- Specified by:
setStandardEnvironmentEnabledin interfaceCelCheckerBuilder
-
addLibraries
@CanIgnoreReturnValue public CelCheckerLegacyImpl.Builder addLibraries(CelCheckerLibrary... libraries)
Adds one or more libraries for parsing and type-checking.- Specified by:
addLibrariesin interfaceCelCheckerBuilder
-
addLibraries
@CanIgnoreReturnValue public CelCheckerLegacyImpl.Builder addLibraries(java.lang.Iterable<? extends CelCheckerLibrary> libraries)
Adds a collection of libraries for parsing and type-checking.- Specified by:
addLibrariesin interfaceCelCheckerBuilder
-
build
@CheckReturnValue public CelCheckerLegacyImpl build()
Build a new instance of theCelChecker.- Specified by:
buildin interfaceCelCheckerBuilder
-
-