Package dev.cel.expr
Class Expr.Comprehension.Builder
java.lang.Object
com.google.protobuf.AbstractMessageLite.Builder
com.google.protobuf.AbstractMessage.Builder<Expr.Comprehension.Builder>
com.google.protobuf.GeneratedMessage.Builder<Expr.Comprehension.Builder>
dev.cel.expr.Expr.Comprehension.Builder
- All Implemented Interfaces:
com.google.protobuf.Message.Builder,com.google.protobuf.MessageLite.Builder,com.google.protobuf.MessageLiteOrBuilder,com.google.protobuf.MessageOrBuilder,Expr.ComprehensionOrBuilder,Cloneable
- Enclosing class:
Expr.Comprehension
public static final class Expr.Comprehension.Builder
extends com.google.protobuf.GeneratedMessage.Builder<Expr.Comprehension.Builder>
implements Expr.ComprehensionOrBuilder
A comprehension expression applied to a list or map.
Comprehensions are not part of the core syntax, but enabled with macros.
A macro matches a specific call signature within a parsed AST and replaces
the call with an alternate AST block. Macro expansion happens at parse
time.
The following macros are supported within CEL:
Aggregate type macros may be applied to all elements in a list or all keys
in a map:
* `all`, `exists`, `exists_one` - test a predicate expression against
the inputs and return `true` if the predicate is satisfied for all,
any, or only one value `list.all(x, x < 10)`.
* `filter` - test a predicate expression against the inputs and return
the subset of elements which satisfy the predicate:
`payments.filter(p, p > 1000)`.
* `map` - apply an expression to all elements in the input and return the
output aggregate type: `[1, 2, 3].map(i, i * i)`.
The `has(m.x)` macro tests whether the property `x` is present in struct
`m`. The semantics of this macro depend on the type of `m`. For proto2
messages `has(m.x)` is defined as 'defined, but not set`. For proto3, the
macro tests whether the property is set to its default. For map and struct
types, the macro tests whether the property `x` is defined on `m`.
Comprehension evaluation can be best visualized as the following
pseudocode:
```
let `accu_var` = `accu_init`
for (let `iter_var` in `iter_range`) {
if (!`loop_condition`) {
break
}
`accu_var` = `loop_step`
}
return `result`
```
Protobuf type cel.expr.Expr.Comprehension-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Exprprivate com.google.protobuf.SingleFieldBuilder<Expr, Expr.Builder, ExprOrBuilder> private Objectprivate intprivate Exprprivate com.google.protobuf.SingleFieldBuilder<Expr, Expr.Builder, ExprOrBuilder> private Objectprivate Exprprivate com.google.protobuf.SingleFieldBuilder<Expr, Expr.Builder, ExprOrBuilder> private Exprprivate com.google.protobuf.SingleFieldBuilder<Expr, Expr.Builder, ExprOrBuilder> private Exprprivate com.google.protobuf.SingleFieldBuilder<Expr, Expr.Builder, ExprOrBuilder> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()private voidbuildPartial0(Expr.Comprehension result) clear()The initial value of the accumulator.The name of the variable used for accumulation of the result.The range over which var iterates.The name of the iteration variable.An expression which can contain iter_var and accu_var.An expression which can contain iter_var and accu_var.An expression which can contain accu_var.The initial value of the accumulator.The initial value of the accumulator.private com.google.protobuf.SingleFieldBuilder<Expr, Expr.Builder, ExprOrBuilder> The initial value of the accumulator.The initial value of the accumulator.The name of the variable used for accumulation of the result.com.google.protobuf.ByteStringThe name of the variable used for accumulation of the result.static final com.google.protobuf.Descriptors.Descriptorcom.google.protobuf.Descriptors.DescriptorThe range over which var iterates.The range over which var iterates.private com.google.protobuf.SingleFieldBuilder<Expr, Expr.Builder, ExprOrBuilder> The range over which var iterates.The range over which var iterates.The name of the iteration variable.com.google.protobuf.ByteStringThe name of the iteration variable.An expression which can contain iter_var and accu_var.An expression which can contain iter_var and accu_var.private com.google.protobuf.SingleFieldBuilder<Expr, Expr.Builder, ExprOrBuilder> An expression which can contain iter_var and accu_var.An expression which can contain iter_var and accu_var.An expression which can contain iter_var and accu_var.An expression which can contain iter_var and accu_var.private com.google.protobuf.SingleFieldBuilder<Expr, Expr.Builder, ExprOrBuilder> An expression which can contain iter_var and accu_var.An expression which can contain iter_var and accu_var.An expression which can contain accu_var.An expression which can contain accu_var.private com.google.protobuf.SingleFieldBuilder<Expr, Expr.Builder, ExprOrBuilder> An expression which can contain accu_var.An expression which can contain accu_var.booleanThe initial value of the accumulator.booleanThe range over which var iterates.booleanAn expression which can contain iter_var and accu_var.booleanAn expression which can contain iter_var and accu_var.booleanAn expression which can contain accu_var.protected com.google.protobuf.GeneratedMessage.FieldAccessorTablefinal booleanprivate voidmergeAccuInit(Expr value) The initial value of the accumulator.mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) mergeFrom(com.google.protobuf.Message other) mergeFrom(Expr.Comprehension other) mergeIterRange(Expr value) The range over which var iterates.mergeLoopCondition(Expr value) An expression which can contain iter_var and accu_var.mergeLoopStep(Expr value) An expression which can contain iter_var and accu_var.mergeResult(Expr value) An expression which can contain accu_var.setAccuInit(Expr value) The initial value of the accumulator.setAccuInit(Expr.Builder builderForValue) The initial value of the accumulator.setAccuVar(String value) The name of the variable used for accumulation of the result.setAccuVarBytes(com.google.protobuf.ByteString value) The name of the variable used for accumulation of the result.setIterRange(Expr value) The range over which var iterates.setIterRange(Expr.Builder builderForValue) The range over which var iterates.setIterVar(String value) The name of the iteration variable.setIterVarBytes(com.google.protobuf.ByteString value) The name of the iteration variable.setLoopCondition(Expr value) An expression which can contain iter_var and accu_var.setLoopCondition(Expr.Builder builderForValue) An expression which can contain iter_var and accu_var.setLoopStep(Expr value) An expression which can contain iter_var and accu_var.setLoopStep(Expr.Builder builderForValue) An expression which can contain iter_var and accu_var.An expression which can contain accu_var.setResult(Expr.Builder builderForValue) An expression which can contain accu_var.Methods inherited from class com.google.protobuf.GeneratedMessage.Builder
addRepeatedField, clearField, clearOneof, clone, getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, getUnknownFieldSetBuilder, hasField, hasOneof, internalGetMapField, internalGetMapFieldReflection, internalGetMutableMapField, internalGetMutableMapFieldReflection, isClean, markClean, mergeUnknownFields, mergeUnknownLengthDelimitedField, mergeUnknownVarintField, newBuilderForField, onBuilt, onChanged, parseUnknownField, setField, setRepeatedField, setUnknownFields, setUnknownFieldSetBuilder, setUnknownFieldsProto3Methods inherited from class com.google.protobuf.AbstractMessage.Builder
findInitializationErrors, getInitializationErrorString, internalMergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toStringMethods inherited from class com.google.protobuf.AbstractMessageLite.Builder
addAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, newUninitializedMessageExceptionMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.google.protobuf.Message.Builder
mergeDelimitedFrom, mergeDelimitedFromMethods inherited from interface com.google.protobuf.MessageLite.Builder
mergeFromMethods inherited from interface com.google.protobuf.MessageOrBuilder
findInitializationErrors, getAllFields, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof
-
Field Details
-
bitField0_
private int bitField0_ -
iterVar_
-
iterRange_
-
iterRangeBuilder_
-
accuVar_
-
accuInit_
-
accuInitBuilder_
-
loopCondition_
-
loopConditionBuilder_
private com.google.protobuf.SingleFieldBuilder<Expr,Expr.Builder, loopConditionBuilder_ExprOrBuilder> -
loopStep_
-
loopStepBuilder_
-
result_
-
resultBuilder_
-
-
Constructor Details
-
Builder
private Builder() -
Builder
private Builder(com.google.protobuf.AbstractMessage.BuilderParent parent)
-
-
Method Details
-
getDescriptor
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() -
internalGetFieldAccessorTable
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()- Specified by:
internalGetFieldAccessorTablein classcom.google.protobuf.GeneratedMessage.Builder<Expr.Comprehension.Builder>
-
maybeForceBuilderInitialization
private void maybeForceBuilderInitialization() -
clear
- Specified by:
clearin interfacecom.google.protobuf.Message.Builder- Specified by:
clearin interfacecom.google.protobuf.MessageLite.Builder- Overrides:
clearin classcom.google.protobuf.GeneratedMessage.Builder<Expr.Comprehension.Builder>
-
getDescriptorForType
public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()- Specified by:
getDescriptorForTypein interfacecom.google.protobuf.Message.Builder- Specified by:
getDescriptorForTypein interfacecom.google.protobuf.MessageOrBuilder- Overrides:
getDescriptorForTypein classcom.google.protobuf.GeneratedMessage.Builder<Expr.Comprehension.Builder>
-
getDefaultInstanceForType
- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageLiteOrBuilder- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageOrBuilder
-
build
- Specified by:
buildin interfacecom.google.protobuf.Message.Builder- Specified by:
buildin interfacecom.google.protobuf.MessageLite.Builder
-
buildPartial
- Specified by:
buildPartialin interfacecom.google.protobuf.Message.Builder- Specified by:
buildPartialin interfacecom.google.protobuf.MessageLite.Builder
-
buildPartial0
-
mergeFrom
- Specified by:
mergeFromin interfacecom.google.protobuf.Message.Builder- Overrides:
mergeFromin classcom.google.protobuf.AbstractMessage.Builder<Expr.Comprehension.Builder>
-
mergeFrom
-
isInitialized
public final boolean isInitialized()- Specified by:
isInitializedin interfacecom.google.protobuf.MessageLiteOrBuilder- Overrides:
isInitializedin classcom.google.protobuf.GeneratedMessage.Builder<Expr.Comprehension.Builder>
-
mergeFrom
public Expr.Comprehension.Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException - Specified by:
mergeFromin interfacecom.google.protobuf.Message.Builder- Specified by:
mergeFromin interfacecom.google.protobuf.MessageLite.Builder- Overrides:
mergeFromin classcom.google.protobuf.AbstractMessage.Builder<Expr.Comprehension.Builder>- Throws:
IOException
-
getIterVar
The name of the iteration variable.
string iter_var = 1;- Specified by:
getIterVarin interfaceExpr.ComprehensionOrBuilder- Returns:
- The iterVar.
-
getIterVarBytes
public com.google.protobuf.ByteString getIterVarBytes()The name of the iteration variable.
string iter_var = 1;- Specified by:
getIterVarBytesin interfaceExpr.ComprehensionOrBuilder- Returns:
- The bytes for iterVar.
-
setIterVar
The name of the iteration variable.
string iter_var = 1;- Parameters:
value- The iterVar to set.- Returns:
- This builder for chaining.
-
clearIterVar
The name of the iteration variable.
string iter_var = 1;- Returns:
- This builder for chaining.
-
setIterVarBytes
The name of the iteration variable.
string iter_var = 1;- Parameters:
value- The bytes for iterVar to set.- Returns:
- This builder for chaining.
-
hasIterRange
public boolean hasIterRange()The range over which var iterates.
.cel.expr.Expr iter_range = 2;- Specified by:
hasIterRangein interfaceExpr.ComprehensionOrBuilder- Returns:
- Whether the iterRange field is set.
-
getIterRange
The range over which var iterates.
.cel.expr.Expr iter_range = 2;- Specified by:
getIterRangein interfaceExpr.ComprehensionOrBuilder- Returns:
- The iterRange.
-
setIterRange
The range over which var iterates.
.cel.expr.Expr iter_range = 2; -
setIterRange
The range over which var iterates.
.cel.expr.Expr iter_range = 2; -
mergeIterRange
The range over which var iterates.
.cel.expr.Expr iter_range = 2; -
clearIterRange
The range over which var iterates.
.cel.expr.Expr iter_range = 2; -
getIterRangeBuilder
The range over which var iterates.
.cel.expr.Expr iter_range = 2; -
getIterRangeOrBuilder
The range over which var iterates.
.cel.expr.Expr iter_range = 2;- Specified by:
getIterRangeOrBuilderin interfaceExpr.ComprehensionOrBuilder
-
getIterRangeFieldBuilder
private com.google.protobuf.SingleFieldBuilder<Expr,Expr.Builder, getIterRangeFieldBuilder()ExprOrBuilder> The range over which var iterates.
.cel.expr.Expr iter_range = 2; -
getAccuVar
The name of the variable used for accumulation of the result.
string accu_var = 3;- Specified by:
getAccuVarin interfaceExpr.ComprehensionOrBuilder- Returns:
- The accuVar.
-
getAccuVarBytes
public com.google.protobuf.ByteString getAccuVarBytes()The name of the variable used for accumulation of the result.
string accu_var = 3;- Specified by:
getAccuVarBytesin interfaceExpr.ComprehensionOrBuilder- Returns:
- The bytes for accuVar.
-
setAccuVar
The name of the variable used for accumulation of the result.
string accu_var = 3;- Parameters:
value- The accuVar to set.- Returns:
- This builder for chaining.
-
clearAccuVar
The name of the variable used for accumulation of the result.
string accu_var = 3;- Returns:
- This builder for chaining.
-
setAccuVarBytes
The name of the variable used for accumulation of the result.
string accu_var = 3;- Parameters:
value- The bytes for accuVar to set.- Returns:
- This builder for chaining.
-
hasAccuInit
public boolean hasAccuInit()The initial value of the accumulator.
.cel.expr.Expr accu_init = 4;- Specified by:
hasAccuInitin interfaceExpr.ComprehensionOrBuilder- Returns:
- Whether the accuInit field is set.
-
getAccuInit
The initial value of the accumulator.
.cel.expr.Expr accu_init = 4;- Specified by:
getAccuInitin interfaceExpr.ComprehensionOrBuilder- Returns:
- The accuInit.
-
setAccuInit
The initial value of the accumulator.
.cel.expr.Expr accu_init = 4; -
setAccuInit
The initial value of the accumulator.
.cel.expr.Expr accu_init = 4; -
mergeAccuInit
The initial value of the accumulator.
.cel.expr.Expr accu_init = 4; -
clearAccuInit
The initial value of the accumulator.
.cel.expr.Expr accu_init = 4; -
getAccuInitBuilder
The initial value of the accumulator.
.cel.expr.Expr accu_init = 4; -
getAccuInitOrBuilder
The initial value of the accumulator.
.cel.expr.Expr accu_init = 4;- Specified by:
getAccuInitOrBuilderin interfaceExpr.ComprehensionOrBuilder
-
getAccuInitFieldBuilder
private com.google.protobuf.SingleFieldBuilder<Expr,Expr.Builder, getAccuInitFieldBuilder()ExprOrBuilder> The initial value of the accumulator.
.cel.expr.Expr accu_init = 4; -
hasLoopCondition
public boolean hasLoopCondition()An expression which can contain iter_var and accu_var. Returns false when the result has been computed and may be used as a hint to short-circuit the remainder of the comprehension.
.cel.expr.Expr loop_condition = 5;- Specified by:
hasLoopConditionin interfaceExpr.ComprehensionOrBuilder- Returns:
- Whether the loopCondition field is set.
-
getLoopCondition
An expression which can contain iter_var and accu_var. Returns false when the result has been computed and may be used as a hint to short-circuit the remainder of the comprehension.
.cel.expr.Expr loop_condition = 5;- Specified by:
getLoopConditionin interfaceExpr.ComprehensionOrBuilder- Returns:
- The loopCondition.
-
setLoopCondition
An expression which can contain iter_var and accu_var. Returns false when the result has been computed and may be used as a hint to short-circuit the remainder of the comprehension.
.cel.expr.Expr loop_condition = 5; -
setLoopCondition
An expression which can contain iter_var and accu_var. Returns false when the result has been computed and may be used as a hint to short-circuit the remainder of the comprehension.
.cel.expr.Expr loop_condition = 5; -
mergeLoopCondition
An expression which can contain iter_var and accu_var. Returns false when the result has been computed and may be used as a hint to short-circuit the remainder of the comprehension.
.cel.expr.Expr loop_condition = 5; -
clearLoopCondition
An expression which can contain iter_var and accu_var. Returns false when the result has been computed and may be used as a hint to short-circuit the remainder of the comprehension.
.cel.expr.Expr loop_condition = 5; -
getLoopConditionBuilder
An expression which can contain iter_var and accu_var. Returns false when the result has been computed and may be used as a hint to short-circuit the remainder of the comprehension.
.cel.expr.Expr loop_condition = 5; -
getLoopConditionOrBuilder
An expression which can contain iter_var and accu_var. Returns false when the result has been computed and may be used as a hint to short-circuit the remainder of the comprehension.
.cel.expr.Expr loop_condition = 5;- Specified by:
getLoopConditionOrBuilderin interfaceExpr.ComprehensionOrBuilder
-
getLoopConditionFieldBuilder
private com.google.protobuf.SingleFieldBuilder<Expr,Expr.Builder, getLoopConditionFieldBuilder()ExprOrBuilder> An expression which can contain iter_var and accu_var. Returns false when the result has been computed and may be used as a hint to short-circuit the remainder of the comprehension.
.cel.expr.Expr loop_condition = 5; -
hasLoopStep
public boolean hasLoopStep()An expression which can contain iter_var and accu_var. Computes the next value of accu_var.
.cel.expr.Expr loop_step = 6;- Specified by:
hasLoopStepin interfaceExpr.ComprehensionOrBuilder- Returns:
- Whether the loopStep field is set.
-
getLoopStep
An expression which can contain iter_var and accu_var. Computes the next value of accu_var.
.cel.expr.Expr loop_step = 6;- Specified by:
getLoopStepin interfaceExpr.ComprehensionOrBuilder- Returns:
- The loopStep.
-
setLoopStep
An expression which can contain iter_var and accu_var. Computes the next value of accu_var.
.cel.expr.Expr loop_step = 6; -
setLoopStep
An expression which can contain iter_var and accu_var. Computes the next value of accu_var.
.cel.expr.Expr loop_step = 6; -
mergeLoopStep
An expression which can contain iter_var and accu_var. Computes the next value of accu_var.
.cel.expr.Expr loop_step = 6; -
clearLoopStep
An expression which can contain iter_var and accu_var. Computes the next value of accu_var.
.cel.expr.Expr loop_step = 6; -
getLoopStepBuilder
An expression which can contain iter_var and accu_var. Computes the next value of accu_var.
.cel.expr.Expr loop_step = 6; -
getLoopStepOrBuilder
An expression which can contain iter_var and accu_var. Computes the next value of accu_var.
.cel.expr.Expr loop_step = 6;- Specified by:
getLoopStepOrBuilderin interfaceExpr.ComprehensionOrBuilder
-
getLoopStepFieldBuilder
private com.google.protobuf.SingleFieldBuilder<Expr,Expr.Builder, getLoopStepFieldBuilder()ExprOrBuilder> An expression which can contain iter_var and accu_var. Computes the next value of accu_var.
.cel.expr.Expr loop_step = 6; -
hasResult
public boolean hasResult()An expression which can contain accu_var. Computes the result.
.cel.expr.Expr result = 7;- Specified by:
hasResultin interfaceExpr.ComprehensionOrBuilder- Returns:
- Whether the result field is set.
-
getResult
An expression which can contain accu_var. Computes the result.
.cel.expr.Expr result = 7;- Specified by:
getResultin interfaceExpr.ComprehensionOrBuilder- Returns:
- The result.
-
setResult
An expression which can contain accu_var. Computes the result.
.cel.expr.Expr result = 7; -
setResult
An expression which can contain accu_var. Computes the result.
.cel.expr.Expr result = 7; -
mergeResult
An expression which can contain accu_var. Computes the result.
.cel.expr.Expr result = 7; -
clearResult
An expression which can contain accu_var. Computes the result.
.cel.expr.Expr result = 7; -
getResultBuilder
An expression which can contain accu_var. Computes the result.
.cel.expr.Expr result = 7; -
getResultOrBuilder
An expression which can contain accu_var. Computes the result.
.cel.expr.Expr result = 7;- Specified by:
getResultOrBuilderin interfaceExpr.ComprehensionOrBuilder
-
getResultFieldBuilder
private com.google.protobuf.SingleFieldBuilder<Expr,Expr.Builder, getResultFieldBuilder()ExprOrBuilder> An expression which can contain accu_var. Computes the result.
.cel.expr.Expr result = 7;
-