Class Expr.Comprehension

java.lang.Object
com.google.protobuf.AbstractMessageLite
com.google.protobuf.AbstractMessage
com.google.protobuf.GeneratedMessageV3
com.google.api.expr.v1alpha1.Expr.Comprehension
All Implemented Interfaces:
Expr.ComprehensionOrBuilder, com.google.protobuf.Message, com.google.protobuf.MessageLite, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, Serializable
Enclosing class:
Expr

public static final class Expr.Comprehension extends com.google.protobuf.GeneratedMessageV3 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
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    A comprehension expression applied to a list or map.

    Nested classes/interfaces inherited from class com.google.protobuf.GeneratedMessageV3

    com.google.protobuf.GeneratedMessageV3.BuilderParent, com.google.protobuf.GeneratedMessageV3.ExtendableBuilder<MessageT extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageT>,BuilderT extends com.google.protobuf.GeneratedMessageV3.ExtendableBuilder<MessageT,BuilderT>>, com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageT extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageT>>, com.google.protobuf.GeneratedMessageV3.ExtendableMessageOrBuilder<MessageT extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageT>>, com.google.protobuf.GeneratedMessageV3.FieldAccessorTable, com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter

    Nested classes/interfaces inherited from class com.google.protobuf.AbstractMessageLite

    com.google.protobuf.AbstractMessageLite.InternalOneOfEnum
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     

    Fields inherited from class com.google.protobuf.GeneratedMessageV3

    alwaysUseFieldBuilders, unknownFields

    Fields inherited from class com.google.protobuf.AbstractMessage

    memoizedSize

    Fields inherited from class com.google.protobuf.AbstractMessageLite

    memoizedHashCode
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    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.ByteString
    The name of the variable used for accumulation of the result.
     
     
    static final com.google.protobuf.Descriptors.Descriptor
     
    The range over which the comprehension iterates.
    The range over which the comprehension iterates.
    The name of the first iteration variable.
    The name of the second iteration variable, empty if not set.
    com.google.protobuf.ByteString
    The name of the second iteration variable, empty if not set.
    com.google.protobuf.ByteString
    The name of the first iteration variable.
    An expression which can contain iter_var, iter_var2, and accu_var.
    An expression which can contain iter_var, iter_var2, and accu_var.
    An expression which can contain iter_var, iter_var2, and accu_var.
    An expression which can contain iter_var, iter_var2, and accu_var.
    com.google.protobuf.Parser<Expr.Comprehension>
     
    An expression which can contain accu_var.
    An expression which can contain accu_var.
    int
     
    boolean
    The initial value of the accumulator.
    int
     
    boolean
    The range over which the comprehension iterates.
    boolean
    An expression which can contain iter_var, iter_var2, and accu_var.
    boolean
    An expression which can contain iter_var, iter_var2, and accu_var.
    boolean
    An expression which can contain accu_var.
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
     
    final boolean
     
     
     
     
    newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)
     
    protected Object
    newInstance(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused)
     
     
    parseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     
    parseFrom(byte[] data)
     
    parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     
    parseFrom(com.google.protobuf.ByteString data)
     
    parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     
    parseFrom(com.google.protobuf.CodedInputStream input)
     
    parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     
     
    parseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     
     
    parseFrom(ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     
    static com.google.protobuf.Parser<Expr.Comprehension>
     
     
    void
    writeTo(com.google.protobuf.CodedOutputStream output)
     

    Methods inherited from class com.google.protobuf.GeneratedMessageV3

    canUseUnsafe, computeStringSize, computeStringSizeNoTag, emptyBooleanList, emptyDoubleList, emptyFloatList, emptyIntList, emptyList, emptyLongList, getAllFields, getDescriptorForType, getField, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof, internalGetMapField, internalGetMapFieldReflection, isStringEmpty, makeExtensionsImmutable, makeMutableCopy, makeMutableCopy, mergeFromAndMakeImmutableInternal, mutableCopy, mutableCopy, mutableCopy, mutableCopy, mutableCopy, newBooleanList, newBuilderForType, newDoubleList, newFloatList, newIntList, newLongList, parseDelimitedWithIOException, parseDelimitedWithIOException, parseUnknownField, parseUnknownFieldProto3, parseWithIOException, parseWithIOException, parseWithIOException, parseWithIOException, serializeBooleanMapTo, serializeIntegerMapTo, serializeLongMapTo, serializeStringMapTo, writeReplace, writeString, writeStringNoTag

    Methods inherited from class com.google.protobuf.AbstractMessage

    findInitializationErrors, getInitializationErrorString, hashBoolean, hashEnum, hashEnumList, hashFields, hashLong, toString

    Methods inherited from class com.google.protobuf.AbstractMessageLite

    addAll, addAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeTo

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface com.google.protobuf.MessageLite

    toByteArray, toByteString, writeDelimitedTo, writeTo

    Methods inherited from interface com.google.protobuf.MessageOrBuilder

    findInitializationErrors, getAllFields, getDescriptorForType, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof
  • Field Details

  • Method Details

    • newInstance

      protected Object newInstance(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused)
      Overrides:
      newInstance in class com.google.protobuf.GeneratedMessageV3
    • getDescriptor

      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
    • internalGetFieldAccessorTable

      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
      Specified by:
      internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3
    • 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;
      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;
      Specified by:
      getIterVarBytes in interface Expr.ComprehensionOrBuilder
      Returns:
      The bytes for iterVar.
    • 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;
      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;
      Specified by:
      getIterVar2Bytes in interface Expr.ComprehensionOrBuilder
      Returns:
      The bytes for iterVar2.
    • hasIterRange

      public boolean hasIterRange()
       The range over which the comprehension iterates.
       
      .google.api.expr.v1alpha1.Expr iter_range = 2;
      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;
      Specified by:
      getIterRange in interface Expr.ComprehensionOrBuilder
      Returns:
      The iterRange.
    • getIterRangeOrBuilder

      public ExprOrBuilder getIterRangeOrBuilder()
       The range over which the comprehension iterates.
       
      .google.api.expr.v1alpha1.Expr iter_range = 2;
      Specified by:
      getIterRangeOrBuilder in interface Expr.ComprehensionOrBuilder
    • getAccuVar

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

      public boolean hasAccuInit()
       The initial value of the accumulator.
       
      .google.api.expr.v1alpha1.Expr accu_init = 4;
      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;
      Specified by:
      getAccuInit in interface Expr.ComprehensionOrBuilder
      Returns:
      The accuInit.
    • getAccuInitOrBuilder

      public ExprOrBuilder getAccuInitOrBuilder()
       The initial value of the accumulator.
       
      .google.api.expr.v1alpha1.Expr accu_init = 4;
      Specified by:
      getAccuInitOrBuilder in interface Expr.ComprehensionOrBuilder
    • 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;
      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;
      Specified by:
      getLoopCondition in interface Expr.ComprehensionOrBuilder
      Returns:
      The loopCondition.
    • getLoopConditionOrBuilder

      public ExprOrBuilder getLoopConditionOrBuilder()
       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;
      Specified by:
      getLoopConditionOrBuilder in interface Expr.ComprehensionOrBuilder
    • 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;
      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;
      Specified by:
      getLoopStep in interface Expr.ComprehensionOrBuilder
      Returns:
      The loopStep.
    • getLoopStepOrBuilder

      public ExprOrBuilder getLoopStepOrBuilder()
       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;
      Specified by:
      getLoopStepOrBuilder in interface Expr.ComprehensionOrBuilder
    • hasResult

      public boolean hasResult()
       An expression which can contain accu_var.
      
       Computes the result.
       
      .google.api.expr.v1alpha1.Expr result = 7;
      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;
      Specified by:
      getResult in interface Expr.ComprehensionOrBuilder
      Returns:
      The result.
    • getResultOrBuilder

      public ExprOrBuilder getResultOrBuilder()
       An expression which can contain accu_var.
      
       Computes the result.
       
      .google.api.expr.v1alpha1.Expr result = 7;
      Specified by:
      getResultOrBuilder in interface Expr.ComprehensionOrBuilder
    • isInitialized

      public final boolean isInitialized()
      Specified by:
      isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
      Overrides:
      isInitialized in class com.google.protobuf.GeneratedMessageV3
    • writeTo

      public void writeTo(com.google.protobuf.CodedOutputStream output) throws IOException
      Specified by:
      writeTo in interface com.google.protobuf.MessageLite
      Overrides:
      writeTo in class com.google.protobuf.GeneratedMessageV3
      Throws:
      IOException
    • getSerializedSize

      public int getSerializedSize()
      Specified by:
      getSerializedSize in interface com.google.protobuf.MessageLite
      Overrides:
      getSerializedSize in class com.google.protobuf.GeneratedMessageV3
    • equals

      public boolean equals(Object obj)
      Specified by:
      equals in interface com.google.protobuf.Message
      Overrides:
      equals in class com.google.protobuf.AbstractMessage
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface com.google.protobuf.Message
      Overrides:
      hashCode in class com.google.protobuf.AbstractMessage
    • parseFrom

      public static Expr.Comprehension parseFrom(ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static Expr.Comprehension parseFrom(ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static Expr.Comprehension parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static Expr.Comprehension parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static Expr.Comprehension parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static Expr.Comprehension parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static Expr.Comprehension parseFrom(InputStream input) throws IOException
      Throws:
      IOException
    • parseFrom

      public static Expr.Comprehension parseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Throws:
      IOException
    • parseDelimitedFrom

      public static Expr.Comprehension parseDelimitedFrom(InputStream input) throws IOException
      Throws:
      IOException
    • parseDelimitedFrom

      public static Expr.Comprehension parseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Throws:
      IOException
    • parseFrom

      public static Expr.Comprehension parseFrom(com.google.protobuf.CodedInputStream input) throws IOException
      Throws:
      IOException
    • parseFrom

      public static Expr.Comprehension parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Throws:
      IOException
    • newBuilderForType

      public Expr.Comprehension.Builder newBuilderForType()
      Specified by:
      newBuilderForType in interface com.google.protobuf.Message
      Specified by:
      newBuilderForType in interface com.google.protobuf.MessageLite
    • newBuilder

      public static Expr.Comprehension.Builder newBuilder()
    • newBuilder

      public static Expr.Comprehension.Builder newBuilder(Expr.Comprehension prototype)
    • toBuilder

      public Expr.Comprehension.Builder toBuilder()
      Specified by:
      toBuilder in interface com.google.protobuf.Message
      Specified by:
      toBuilder in interface com.google.protobuf.MessageLite
    • newBuilderForType

      protected Expr.Comprehension.Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)
      Specified by:
      newBuilderForType in class com.google.protobuf.GeneratedMessageV3
    • getDefaultInstance

      public static Expr.Comprehension getDefaultInstance()
    • parser

      public static com.google.protobuf.Parser<Expr.Comprehension> parser()
    • getParserForType

      public com.google.protobuf.Parser<Expr.Comprehension> getParserForType()
      Specified by:
      getParserForType in interface com.google.protobuf.Message
      Specified by:
      getParserForType in interface com.google.protobuf.MessageLite
      Overrides:
      getParserForType in class com.google.protobuf.GeneratedMessageV3
    • getDefaultInstanceForType

      public Expr.Comprehension getDefaultInstanceForType()
      Specified by:
      getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
      Specified by:
      getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder