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 CelCheckerBuilderaddDeclarations(Decl... declarations)Add variable and functiondeclarationsto the CEL environment.CelCheckerBuilderaddDeclarations(java.lang.Iterable<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.CelCheckerLegacyImplbuild()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 celOptions)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.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 typeProvider)Deprecated.CelCheckerBuildersetTypeProvider(CelTypeProvider celTypeProvider)Set thecelTypeProviderfor use with type-checking expressions.
-
-
-
Method Detail
-
setOptions
public CelCheckerBuilder setOptions(CelOptions celOptions)
Description copied from interface:CelCheckerBuilderSet theCelOptionsused to enable fixes and features for this CEL instances.- Specified by:
setOptionsin interfaceCelCheckerBuilder
-
setContainer
public CelCheckerBuilder setContainer(java.lang.String container)
Description copied from interface:CelCheckerBuilderSet thecontainername to use as the namespace for resolving CEL expression variables and functions.- Specified by:
setContainerin interfaceCelCheckerBuilder
-
addDeclarations
public CelCheckerBuilder addDeclarations(Decl... declarations)
Description copied from interface:CelCheckerBuilderAdd variable and functiondeclarationsto the CEL environment.- Specified by:
addDeclarationsin interfaceCelCheckerBuilder
-
addDeclarations
public CelCheckerBuilder addDeclarations(java.lang.Iterable<Decl> declarations)
Description copied from interface:CelCheckerBuilderAdd variable and functiondeclarationsto the CEL environment.- Specified by:
addDeclarationsin interfaceCelCheckerBuilder
-
addFunctionDeclarations
@CanIgnoreReturnValue public CelCheckerBuilder addFunctionDeclarations(CelFunctionDecl... celFunctionDecls)
Description copied from interface:CelCheckerBuilderAdd function declarationCelFunctionDeclto the CEL environment.- Specified by:
addFunctionDeclarationsin interfaceCelCheckerBuilder
-
addFunctionDeclarations
public CelCheckerBuilder addFunctionDeclarations(java.lang.Iterable<CelFunctionDecl> celFunctionDecls)
Description copied from interface:CelCheckerBuilderAdd function declarationCelFunctionDeclto the CEL environment.- Specified by:
addFunctionDeclarationsin interfaceCelCheckerBuilder
-
addVarDeclarations
public CelCheckerBuilder addVarDeclarations(CelVarDecl... celVarDecls)
Description copied from interface:CelCheckerBuilderAdd variable declarationCelVarDeclto the CEL environment.- Specified by:
addVarDeclarationsin interfaceCelCheckerBuilder
-
addVarDeclarations
public CelCheckerBuilder addVarDeclarations(java.lang.Iterable<CelVarDecl> celVarDecls)
Description copied from interface:CelCheckerBuilderAdd variable declarationCelVarDeclto the CEL environment.- Specified by:
addVarDeclarationsin interfaceCelCheckerBuilder
-
addProtoTypeMasks
public CelCheckerBuilder addProtoTypeMasks(ProtoTypeMask... typeMasks)
Description copied from interface:CelCheckerBuilderAdd 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
public CelCheckerBuilder addProtoTypeMasks(java.lang.Iterable<ProtoTypeMask> typeMasks)
Description copied from interface:CelCheckerBuilderAdd 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
public CelCheckerBuilder setResultType(CelType resultType)
Description copied from interface:CelCheckerBuilderSet the expectedresultTypefor the type-checked expression.- Specified by:
setResultTypein interfaceCelCheckerBuilder
-
setProtoResultType
public CelCheckerBuilder setProtoResultType(Type resultType)
Description copied from interface:CelCheckerBuilderSet the expectedresultTypein proto format described in checked.proto for the type-checked expression.- Specified by:
setProtoResultTypein interfaceCelCheckerBuilder
-
setTypeProvider
@Deprecated public CelCheckerBuilder setTypeProvider(TypeProvider typeProvider)
Deprecated.Description copied from interface:CelCheckerBuilderSet thetypeProviderfor use with type-checking expressions.- Specified by:
setTypeProviderin interfaceCelCheckerBuilder
-
setTypeProvider
public CelCheckerBuilder setTypeProvider(CelTypeProvider celTypeProvider)
Description copied from interface:CelCheckerBuilderSet thecelTypeProviderfor use with type-checking expressions.- Specified by:
setTypeProviderin interfaceCelCheckerBuilder
-
addMessageTypes
public CelCheckerBuilder addMessageTypes(com.google.protobuf.Descriptors.Descriptor... descriptors)
Description copied from interface:CelCheckerBuilderAdd messageDescriptors.Descriptors to the use for type-checking and object creation at interpretation time.- Specified by:
addMessageTypesin interfaceCelCheckerBuilder
-
addMessageTypes
public CelCheckerBuilder addMessageTypes(java.lang.Iterable<com.google.protobuf.Descriptors.Descriptor> descriptors)
Description copied from interface:CelCheckerBuilderAdd messageDescriptors.Descriptors to the use for type-checking and object creation at interpretation time.- Specified by:
addMessageTypesin interfaceCelCheckerBuilder
-
addFileTypes
public CelCheckerBuilder addFileTypes(com.google.protobuf.Descriptors.FileDescriptor... fileDescriptors)
Description copied from interface:CelCheckerBuilderAddDescriptors.FileDescriptors to the use for type-checking, and for object creation at interpretation time.- Specified by:
addFileTypesin interfaceCelCheckerBuilder
-
addFileTypes
public CelCheckerBuilder addFileTypes(java.lang.Iterable<com.google.protobuf.Descriptors.FileDescriptor> fileDescriptors)
Description copied from interface:CelCheckerBuilderAddDescriptors.FileDescriptors to the use for type-checking, and for object creation at interpretation time.- Specified by:
addFileTypesin interfaceCelCheckerBuilder
-
addFileTypes
public CelCheckerBuilder addFileTypes(com.google.protobuf.DescriptorProtos.FileDescriptorSet fileDescriptorSet)
Description copied from interface:CelCheckerBuilderAdd all of theDescriptors.FileDescriptors in aFileDescriptorSetto the use for type-checking, and for object creation at interpretation time.- Specified by:
addFileTypesin interfaceCelCheckerBuilder
-
setStandardEnvironmentEnabled
public CelCheckerBuilder setStandardEnvironmentEnabled(boolean value)
Description copied from interface:CelCheckerBuilderEnable or disable the standard CEL library functions and variables- Specified by:
setStandardEnvironmentEnabledin interfaceCelCheckerBuilder
-
setStandardDeclarations
public CelCheckerBuilder setStandardDeclarations(CelStandardDeclarations standardDeclarations)
Description copied from interface:CelCheckerBuilderOverride 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.CelCheckerBuilder.setStandardEnvironmentEnabled(boolean)must be set to false for this to take effect.- Specified by:
setStandardDeclarationsin interfaceCelCheckerBuilder
-
addLibraries
public CelCheckerBuilder addLibraries(CelCheckerLibrary... libraries)
Description copied from interface:CelCheckerBuilderAdds one or more libraries for parsing and type-checking.- Specified by:
addLibrariesin interfaceCelCheckerBuilder
-
addLibraries
public CelCheckerBuilder addLibraries(java.lang.Iterable<? extends CelCheckerLibrary> libraries)
Description copied from interface:CelCheckerBuilderAdds a collection of libraries for parsing and type-checking.- Specified by:
addLibrariesin interfaceCelCheckerBuilder
-
build
@CheckReturnValue public CelCheckerLegacyImpl build()
Description copied from interface:CelCheckerBuilderBuild a new instance of theCelChecker.- Specified by:
buildin interfaceCelCheckerBuilder
-
-