Class Expr.Comprehension.Builder

java.lang.Object
com.google.protobuf.AbstractMessageLite.Builder<MessageType,BuilderType>
com.google.protobuf.GeneratedMessageLite.Builder<Expr.Comprehension,Expr.Comprehension.Builder>
com.google.api.expr.v1alpha1.Expr.Comprehension.Builder
All Implemented Interfaces:
Expr.ComprehensionOrBuilder, com.google.protobuf.MessageLite.Builder, com.google.protobuf.MessageLiteOrBuilder, Cloneable
Enclosing class:
Expr.Comprehension

public static final class Expr.Comprehension.Builder extends com.google.protobuf.GeneratedMessageLite.Builder<Expr.Comprehension,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`.

 Comprehensions for the standard environment macros 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`
 ```

 Comprehensions for the optional V2 macros which support map-to-map
 translation differ slightly from the standard environment macros in that
 they expose both the key or index in addition to the value for each list
 or map entry:

 ```
 let `accu_var` = `accu_init`
 for (let `iter_var`, `iter_var2` in `iter_range`) {
 if (!`loop_condition`) {
 break
 }
 `accu_var` = `loop_step`
 }
 return `result`
 ```
 
Protobuf type google.api.expr.v1alpha1.Expr.Comprehension
  • Method Details

    • getIterVar

      public String getIterVar()
       The name of the first iteration variable.
       When the iter_range is a list, this variable is the list element.
       When the iter_range is a map, this variable is the map entry key.
       
      string iter_var = 1 [json_name = "iterVar"];
      Specified by:
      getIterVar in interface Expr.ComprehensionOrBuilder
      Returns:
      The iterVar.
    • getIterVarBytes

      public com.google.protobuf.ByteString getIterVarBytes()
       The name of the first iteration variable.
       When the iter_range is a list, this variable is the list element.
       When the iter_range is a map, this variable is the map entry key.
       
      string iter_var = 1 [json_name = "iterVar"];
      Specified by:
      getIterVarBytes in interface Expr.ComprehensionOrBuilder
      Returns:
      The bytes for iterVar.
    • setIterVar

      public Expr.Comprehension.Builder setIterVar(String value)
       The name of the first iteration variable.
       When the iter_range is a list, this variable is the list element.
       When the iter_range is a map, this variable is the map entry key.
       
      string iter_var = 1 [json_name = "iterVar"];
      Parameters:
      value - The iterVar to set.
      Returns:
      This builder for chaining.
    • clearIterVar

      public Expr.Comprehension.Builder clearIterVar()
       The name of the first iteration variable.
       When the iter_range is a list, this variable is the list element.
       When the iter_range is a map, this variable is the map entry key.
       
      string iter_var = 1 [json_name = "iterVar"];
      Returns:
      This builder for chaining.
    • setIterVarBytes

      public Expr.Comprehension.Builder setIterVarBytes(com.google.protobuf.ByteString value)
       The name of the first iteration variable.
       When the iter_range is a list, this variable is the list element.
       When the iter_range is a map, this variable is the map entry key.
       
      string iter_var = 1 [json_name = "iterVar"];
      Parameters:
      value - The bytes for iterVar to set.
      Returns:
      This builder for chaining.
    • getIterVar2

      public String getIterVar2()
       The name of the second iteration variable, empty if not set.
       When the iter_range is a list, this variable is the integer index.
       When the iter_range is a map, this variable is the map entry value.
       This field is only set for comprehension v2 macros.
       
      string iter_var2 = 8 [json_name = "iterVar2"];
      Specified by:
      getIterVar2 in interface Expr.ComprehensionOrBuilder
      Returns:
      The iterVar2.
    • getIterVar2Bytes

      public com.google.protobuf.ByteString getIterVar2Bytes()
       The name of the second iteration variable, empty if not set.
       When the iter_range is a list, this variable is the integer index.
       When the iter_range is a map, this variable is the map entry value.
       This field is only set for comprehension v2 macros.
       
      string iter_var2 = 8 [json_name = "iterVar2"];
      Specified by:
      getIterVar2Bytes in interface Expr.ComprehensionOrBuilder
      Returns:
      The bytes for iterVar2.
    • setIterVar2

      public Expr.Comprehension.Builder setIterVar2(String value)
       The name of the second iteration variable, empty if not set.
       When the iter_range is a list, this variable is the integer index.
       When the iter_range is a map, this variable is the map entry value.
       This field is only set for comprehension v2 macros.
       
      string iter_var2 = 8 [json_name = "iterVar2"];
      Parameters:
      value - The iterVar2 to set.
      Returns:
      This builder for chaining.
    • clearIterVar2

      public Expr.Comprehension.Builder clearIterVar2()
       The name of the second iteration variable, empty if not set.
       When the iter_range is a list, this variable is the integer index.
       When the iter_range is a map, this variable is the map entry value.
       This field is only set for comprehension v2 macros.
       
      string iter_var2 = 8 [json_name = "iterVar2"];
      Returns:
      This builder for chaining.
    • setIterVar2Bytes

      public Expr.Comprehension.Builder setIterVar2Bytes(com.google.protobuf.ByteString value)
       The name of the second iteration variable, empty if not set.
       When the iter_range is a list, this variable is the integer index.
       When the iter_range is a map, this variable is the map entry value.
       This field is only set for comprehension v2 macros.
       
      string iter_var2 = 8 [json_name = "iterVar2"];
      Parameters:
      value - The bytes for iterVar2 to set.
      Returns:
      This builder for chaining.
    • hasIterRange

      public boolean hasIterRange()
       The range over which the comprehension iterates.
       
      .google.api.expr.v1alpha1.Expr iter_range = 2 [json_name = "iterRange"];
      Specified by:
      hasIterRange in interface Expr.ComprehensionOrBuilder
      Returns:
      Whether the iterRange field is set.
    • getIterRange

      public Expr getIterRange()
       The range over which the comprehension iterates.
       
      .google.api.expr.v1alpha1.Expr iter_range = 2 [json_name = "iterRange"];
      Specified by:
      getIterRange in interface Expr.ComprehensionOrBuilder
      Returns:
      The iterRange.
    • setIterRange

      public Expr.Comprehension.Builder setIterRange(Expr value)
       The range over which the comprehension iterates.
       
      .google.api.expr.v1alpha1.Expr iter_range = 2 [json_name = "iterRange"];
    • setIterRange

      public Expr.Comprehension.Builder setIterRange(Expr.Builder builderForValue)
       The range over which the comprehension iterates.
       
      .google.api.expr.v1alpha1.Expr iter_range = 2 [json_name = "iterRange"];
    • mergeIterRange

      public Expr.Comprehension.Builder mergeIterRange(Expr value)
       The range over which the comprehension iterates.
       
      .google.api.expr.v1alpha1.Expr iter_range = 2 [json_name = "iterRange"];
    • clearIterRange

      public Expr.Comprehension.Builder clearIterRange()
       The range over which the comprehension iterates.
       
      .google.api.expr.v1alpha1.Expr iter_range = 2 [json_name = "iterRange"];
    • getAccuVar

      public String getAccuVar()
       The name of the variable used for accumulation of the result.
       
      string accu_var = 3 [json_name = "accuVar"];
      Specified by:
      getAccuVar in interface Expr.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 [json_name = "accuVar"];
      Specified by:
      getAccuVarBytes in interface Expr.ComprehensionOrBuilder
      Returns:
      The bytes for accuVar.
    • setAccuVar

      public Expr.Comprehension.Builder setAccuVar(String value)
       The name of the variable used for accumulation of the result.
       
      string accu_var = 3 [json_name = "accuVar"];
      Parameters:
      value - The accuVar to set.
      Returns:
      This builder for chaining.
    • clearAccuVar

      public Expr.Comprehension.Builder clearAccuVar()
       The name of the variable used for accumulation of the result.
       
      string accu_var = 3 [json_name = "accuVar"];
      Returns:
      This builder for chaining.
    • setAccuVarBytes

      public Expr.Comprehension.Builder setAccuVarBytes(com.google.protobuf.ByteString value)
       The name of the variable used for accumulation of the result.
       
      string accu_var = 3 [json_name = "accuVar"];
      Parameters:
      value - The bytes for accuVar to set.
      Returns:
      This builder for chaining.
    • hasAccuInit

      public boolean hasAccuInit()
       The initial value of the accumulator.
       
      .google.api.expr.v1alpha1.Expr accu_init = 4 [json_name = "accuInit"];
      Specified by:
      hasAccuInit in interface Expr.ComprehensionOrBuilder
      Returns:
      Whether the accuInit field is set.
    • getAccuInit

      public Expr getAccuInit()
       The initial value of the accumulator.
       
      .google.api.expr.v1alpha1.Expr accu_init = 4 [json_name = "accuInit"];
      Specified by:
      getAccuInit in interface Expr.ComprehensionOrBuilder
      Returns:
      The accuInit.
    • setAccuInit

      public Expr.Comprehension.Builder setAccuInit(Expr value)
       The initial value of the accumulator.
       
      .google.api.expr.v1alpha1.Expr accu_init = 4 [json_name = "accuInit"];
    • setAccuInit

      public Expr.Comprehension.Builder setAccuInit(Expr.Builder builderForValue)
       The initial value of the accumulator.
       
      .google.api.expr.v1alpha1.Expr accu_init = 4 [json_name = "accuInit"];
    • mergeAccuInit

      public Expr.Comprehension.Builder mergeAccuInit(Expr value)
       The initial value of the accumulator.
       
      .google.api.expr.v1alpha1.Expr accu_init = 4 [json_name = "accuInit"];
    • clearAccuInit

      public Expr.Comprehension.Builder clearAccuInit()
       The initial value of the accumulator.
       
      .google.api.expr.v1alpha1.Expr accu_init = 4 [json_name = "accuInit"];
    • hasLoopCondition

      public boolean hasLoopCondition()
       An expression which can contain iter_var, iter_var2, 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.
       
      .google.api.expr.v1alpha1.Expr loop_condition = 5 [json_name = "loopCondition"];
      Specified by:
      hasLoopCondition in interface Expr.ComprehensionOrBuilder
      Returns:
      Whether the loopCondition field is set.
    • getLoopCondition

      public Expr getLoopCondition()
       An expression which can contain iter_var, iter_var2, 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.
       
      .google.api.expr.v1alpha1.Expr loop_condition = 5 [json_name = "loopCondition"];
      Specified by:
      getLoopCondition in interface Expr.ComprehensionOrBuilder
      Returns:
      The loopCondition.
    • setLoopCondition

      public Expr.Comprehension.Builder setLoopCondition(Expr value)
       An expression which can contain iter_var, iter_var2, 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.
       
      .google.api.expr.v1alpha1.Expr loop_condition = 5 [json_name = "loopCondition"];
    • setLoopCondition

      public Expr.Comprehension.Builder setLoopCondition(Expr.Builder builderForValue)
       An expression which can contain iter_var, iter_var2, 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.
       
      .google.api.expr.v1alpha1.Expr loop_condition = 5 [json_name = "loopCondition"];
    • mergeLoopCondition

      public Expr.Comprehension.Builder mergeLoopCondition(Expr value)
       An expression which can contain iter_var, iter_var2, 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.
       
      .google.api.expr.v1alpha1.Expr loop_condition = 5 [json_name = "loopCondition"];
    • clearLoopCondition

      public Expr.Comprehension.Builder clearLoopCondition()
       An expression which can contain iter_var, iter_var2, 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.
       
      .google.api.expr.v1alpha1.Expr loop_condition = 5 [json_name = "loopCondition"];
    • hasLoopStep

      public boolean hasLoopStep()
       An expression which can contain iter_var, iter_var2, and accu_var.
      
       Computes the next value of accu_var.
       
      .google.api.expr.v1alpha1.Expr loop_step = 6 [json_name = "loopStep"];
      Specified by:
      hasLoopStep in interface Expr.ComprehensionOrBuilder
      Returns:
      Whether the loopStep field is set.
    • getLoopStep

      public Expr getLoopStep()
       An expression which can contain iter_var, iter_var2, and accu_var.
      
       Computes the next value of accu_var.
       
      .google.api.expr.v1alpha1.Expr loop_step = 6 [json_name = "loopStep"];
      Specified by:
      getLoopStep in interface Expr.ComprehensionOrBuilder
      Returns:
      The loopStep.
    • setLoopStep

      public Expr.Comprehension.Builder setLoopStep(Expr value)
       An expression which can contain iter_var, iter_var2, and accu_var.
      
       Computes the next value of accu_var.
       
      .google.api.expr.v1alpha1.Expr loop_step = 6 [json_name = "loopStep"];
    • setLoopStep

      public Expr.Comprehension.Builder setLoopStep(Expr.Builder builderForValue)
       An expression which can contain iter_var, iter_var2, and accu_var.
      
       Computes the next value of accu_var.
       
      .google.api.expr.v1alpha1.Expr loop_step = 6 [json_name = "loopStep"];
    • mergeLoopStep

      public Expr.Comprehension.Builder mergeLoopStep(Expr value)
       An expression which can contain iter_var, iter_var2, and accu_var.
      
       Computes the next value of accu_var.
       
      .google.api.expr.v1alpha1.Expr loop_step = 6 [json_name = "loopStep"];
    • clearLoopStep

      public Expr.Comprehension.Builder clearLoopStep()
       An expression which can contain iter_var, iter_var2, and accu_var.
      
       Computes the next value of accu_var.
       
      .google.api.expr.v1alpha1.Expr loop_step = 6 [json_name = "loopStep"];
    • hasResult

      public boolean hasResult()
       An expression which can contain accu_var.
      
       Computes the result.
       
      .google.api.expr.v1alpha1.Expr result = 7 [json_name = "result"];
      Specified by:
      hasResult in interface Expr.ComprehensionOrBuilder
      Returns:
      Whether the result field is set.
    • getResult

      public Expr getResult()
       An expression which can contain accu_var.
      
       Computes the result.
       
      .google.api.expr.v1alpha1.Expr result = 7 [json_name = "result"];
      Specified by:
      getResult in interface Expr.ComprehensionOrBuilder
      Returns:
      The result.
    • setResult

      public Expr.Comprehension.Builder setResult(Expr value)
       An expression which can contain accu_var.
      
       Computes the result.
       
      .google.api.expr.v1alpha1.Expr result = 7 [json_name = "result"];
    • setResult

      public Expr.Comprehension.Builder setResult(Expr.Builder builderForValue)
       An expression which can contain accu_var.
      
       Computes the result.
       
      .google.api.expr.v1alpha1.Expr result = 7 [json_name = "result"];
    • mergeResult

      public Expr.Comprehension.Builder mergeResult(Expr value)
       An expression which can contain accu_var.
      
       Computes the result.
       
      .google.api.expr.v1alpha1.Expr result = 7 [json_name = "result"];
    • clearResult

      public Expr.Comprehension.Builder clearResult()
       An expression which can contain accu_var.
      
       Computes the result.
       
      .google.api.expr.v1alpha1.Expr result = 7 [json_name = "result"];