Package dev.cel.expr
Class Expr
- java.lang.Object
-
- All Implemented Interfaces:
Message
,MessageLite
,MessageLiteOrBuilder
,MessageOrBuilder
,ExprOrBuilder
,java.io.Serializable
public final class Expr extends GeneratedMessageV3 implements ExprOrBuilder
An abstract representation of a common expression. Expressions are abstractly represented as a collection of identifiers, select statements, function calls, literals, and comprehensions. All operators with the exception of the '.' operator are modelled as function calls. This makes it easy to represent new operators into the existing AST. All references within expressions must resolve to a [Decl][cel.expr.Decl] provided at type-check for an expression to be valid. A reference may either be a bare identifier `name` or a qualified identifier `google.api.name`. References may either refer to a value or a function declaration. For example, the expression `google.api.name.startsWith('expr')` references the declaration `google.api.name` within a [Expr.Select][cel.expr.Expr.Select] expression, and the function declaration `startsWith`.
Protobuf typecel.expr.Expr
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Expr.Builder
An abstract representation of a common expression.static class
Expr.Call
A call expression, including calls to predefined functions and operators.static interface
Expr.CallOrBuilder
static class
Expr.Comprehension
A comprehension expression applied to a list or map.static interface
Expr.ComprehensionOrBuilder
static class
Expr.CreateList
A list creation expression.static interface
Expr.CreateListOrBuilder
static class
Expr.CreateStruct
A map or message creation expression.static interface
Expr.CreateStructOrBuilder
static class
Expr.ExprKindCase
static class
Expr.Ident
An identifier expression.static interface
Expr.IdentOrBuilder
static class
Expr.Select
A field selection expression.static interface
Expr.SelectOrBuilder
-
Nested classes/interfaces inherited from class com.google.protobuf.GeneratedMessageV3
GeneratedMessageV3.BuilderParent, GeneratedMessageV3.ExtendableBuilder<MessageType extends GeneratedMessageV3.ExtendableMessage,BuilderType extends GeneratedMessageV3.ExtendableBuilder<MessageType,BuilderType>>, GeneratedMessageV3.ExtendableMessage<MessageType extends GeneratedMessageV3.ExtendableMessage>, GeneratedMessageV3.ExtendableMessageOrBuilder<MessageType extends GeneratedMessageV3.ExtendableMessage>, GeneratedMessageV3.FieldAccessorTable, GeneratedMessageV3.UnusedPrivateParameter
-
Nested classes/interfaces inherited from class com.google.protobuf.AbstractMessageLite
AbstractMessageLite.InternalOneOfEnum
-
-
Field Summary
Fields Modifier and Type Field Description static int
CALL_EXPR_FIELD_NUMBER
static int
COMPREHENSION_EXPR_FIELD_NUMBER
static int
CONST_EXPR_FIELD_NUMBER
static int
ID_FIELD_NUMBER
static int
IDENT_EXPR_FIELD_NUMBER
static int
LIST_EXPR_FIELD_NUMBER
static int
SELECT_EXPR_FIELD_NUMBER
static int
STRUCT_EXPR_FIELD_NUMBER
-
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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
Compares the specified object with this message for equality.Expr.Call
getCallExpr()
A call expression, including calls to predefined functions and operators.Expr.CallOrBuilder
getCallExprOrBuilder()
A call expression, including calls to predefined functions and operators.Expr.Comprehension
getComprehensionExpr()
A comprehension expression.Expr.ComprehensionOrBuilder
getComprehensionExprOrBuilder()
A comprehension expression.Constant
getConstExpr()
A constant expression.ConstantOrBuilder
getConstExprOrBuilder()
A constant expression.static Expr
getDefaultInstance()
Expr
getDefaultInstanceForType()
Get an instance of the type with no fields set.static Descriptors.Descriptor
getDescriptor()
Expr.ExprKindCase
getExprKindCase()
long
getId()
Required.Expr.Ident
getIdentExpr()
An identifier expression.Expr.IdentOrBuilder
getIdentExprOrBuilder()
An identifier expression.Expr.CreateList
getListExpr()
A list creation expression.Expr.CreateListOrBuilder
getListExprOrBuilder()
A list creation expression.Parser<Expr>
getParserForType()
Gets the parser for a message of the same type as this message.Expr.Select
getSelectExpr()
A field selection expression, e.g.Expr.SelectOrBuilder
getSelectExprOrBuilder()
A field selection expression, e.g.int
getSerializedSize()
Get the number of bytes required to encode this message.Expr.CreateStruct
getStructExpr()
A map or message creation expression.Expr.CreateStructOrBuilder
getStructExprOrBuilder()
A map or message creation expression.UnknownFieldSet
getUnknownFields()
Get theUnknownFieldSet
for this message.boolean
hasCallExpr()
A call expression, including calls to predefined functions and operators.boolean
hasComprehensionExpr()
A comprehension expression.boolean
hasConstExpr()
A constant expression.int
hashCode()
Returns the hash code value for this message.boolean
hasIdentExpr()
An identifier expression.boolean
hasListExpr()
A list creation expression.boolean
hasSelectExpr()
A field selection expression, e.g.boolean
hasStructExpr()
A map or message creation expression.protected GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable()
Get the FieldAccessorTable for this type.boolean
isInitialized()
Returns true if all required fields in the message and all embedded messages are set, false otherwise.static Expr.Builder
newBuilder()
static Expr.Builder
newBuilder(Expr prototype)
Expr.Builder
newBuilderForType()
Constructs a new builder for a message of the same type as this message.protected Expr.Builder
newBuilderForType(GeneratedMessageV3.BuilderParent parent)
TODO(xiaofeng): remove this together with GeneratedMessageV3.BuilderParent.protected java.lang.Object
newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Creates a new instance of this message type.static Expr
parseDelimitedFrom(java.io.InputStream input)
static Expr
parseDelimitedFrom(java.io.InputStream input, ExtensionRegistryLite extensionRegistry)
static Expr
parseFrom(byte[] data)
static Expr
parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
static Expr
parseFrom(ByteString data)
static Expr
parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
static Expr
parseFrom(CodedInputStream input)
static Expr
parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
static Expr
parseFrom(java.io.InputStream input)
static Expr
parseFrom(java.io.InputStream input, ExtensionRegistryLite extensionRegistry)
static Expr
parseFrom(java.nio.ByteBuffer data)
static Expr
parseFrom(java.nio.ByteBuffer data, ExtensionRegistryLite extensionRegistry)
static Parser<Expr>
parser()
Expr.Builder
toBuilder()
Constructs a builder initialized with the current message.void
writeTo(CodedOutputStream output)
Serializes the message and writes it tooutput
.-
Methods inherited from class com.google.protobuf.GeneratedMessageV3
canUseUnsafe, computeStringSize, computeStringSizeNoTag, emptyBooleanList, emptyDoubleList, emptyFloatList, emptyIntList, emptyLongList, getAllFields, getDescriptorForType, getField, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, hasField, hasOneof, internalGetMapField, isStringEmpty, makeExtensionsImmutable, 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, hasField, hasOneof
-
-
-
-
Field Detail
-
ID_FIELD_NUMBER
public static final int ID_FIELD_NUMBER
- See Also:
- Constant Field Values
-
CONST_EXPR_FIELD_NUMBER
public static final int CONST_EXPR_FIELD_NUMBER
- See Also:
- Constant Field Values
-
IDENT_EXPR_FIELD_NUMBER
public static final int IDENT_EXPR_FIELD_NUMBER
- See Also:
- Constant Field Values
-
SELECT_EXPR_FIELD_NUMBER
public static final int SELECT_EXPR_FIELD_NUMBER
- See Also:
- Constant Field Values
-
CALL_EXPR_FIELD_NUMBER
public static final int CALL_EXPR_FIELD_NUMBER
- See Also:
- Constant Field Values
-
LIST_EXPR_FIELD_NUMBER
public static final int LIST_EXPR_FIELD_NUMBER
- See Also:
- Constant Field Values
-
STRUCT_EXPR_FIELD_NUMBER
public static final int STRUCT_EXPR_FIELD_NUMBER
- See Also:
- Constant Field Values
-
COMPREHENSION_EXPR_FIELD_NUMBER
public static final int COMPREHENSION_EXPR_FIELD_NUMBER
- See Also:
- Constant Field Values
-
-
Method Detail
-
newInstance
protected java.lang.Object newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Description copied from class:GeneratedMessageV3
Creates a new instance of this message type. Overridden in the generated code.- Overrides:
newInstance
in classGeneratedMessageV3
-
getUnknownFields
public final UnknownFieldSet getUnknownFields()
Description copied from interface:MessageOrBuilder
Get theUnknownFieldSet
for this message.- Specified by:
getUnknownFields
in interfaceMessageOrBuilder
- Overrides:
getUnknownFields
in classGeneratedMessageV3
-
getDescriptor
public static final Descriptors.Descriptor getDescriptor()
-
internalGetFieldAccessorTable
protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Description copied from class:GeneratedMessageV3
Get the FieldAccessorTable for this type. We can't have the message class pass this in to the constructor because of bootstrapping trouble with DescriptorProtos.- Specified by:
internalGetFieldAccessorTable
in classGeneratedMessageV3
-
getExprKindCase
public Expr.ExprKindCase getExprKindCase()
- Specified by:
getExprKindCase
in interfaceExprOrBuilder
-
getId
public long getId()
Required. An id assigned to this node by the parser which is unique in a given expression tree. This is used to associate type information and other attributes to a node in the parse tree.
int64 id = 2;
- Specified by:
getId
in interfaceExprOrBuilder
- Returns:
- The id.
-
hasConstExpr
public boolean hasConstExpr()
A constant expression.
.cel.expr.Constant const_expr = 3;
- Specified by:
hasConstExpr
in interfaceExprOrBuilder
- Returns:
- Whether the constExpr field is set.
-
getConstExpr
public Constant getConstExpr()
A constant expression.
.cel.expr.Constant const_expr = 3;
- Specified by:
getConstExpr
in interfaceExprOrBuilder
- Returns:
- The constExpr.
-
getConstExprOrBuilder
public ConstantOrBuilder getConstExprOrBuilder()
A constant expression.
.cel.expr.Constant const_expr = 3;
- Specified by:
getConstExprOrBuilder
in interfaceExprOrBuilder
-
hasIdentExpr
public boolean hasIdentExpr()
An identifier expression.
.cel.expr.Expr.Ident ident_expr = 4;
- Specified by:
hasIdentExpr
in interfaceExprOrBuilder
- Returns:
- Whether the identExpr field is set.
-
getIdentExpr
public Expr.Ident getIdentExpr()
An identifier expression.
.cel.expr.Expr.Ident ident_expr = 4;
- Specified by:
getIdentExpr
in interfaceExprOrBuilder
- Returns:
- The identExpr.
-
getIdentExprOrBuilder
public Expr.IdentOrBuilder getIdentExprOrBuilder()
An identifier expression.
.cel.expr.Expr.Ident ident_expr = 4;
- Specified by:
getIdentExprOrBuilder
in interfaceExprOrBuilder
-
hasSelectExpr
public boolean hasSelectExpr()
A field selection expression, e.g. `request.auth`.
.cel.expr.Expr.Select select_expr = 5;
- Specified by:
hasSelectExpr
in interfaceExprOrBuilder
- Returns:
- Whether the selectExpr field is set.
-
getSelectExpr
public Expr.Select getSelectExpr()
A field selection expression, e.g. `request.auth`.
.cel.expr.Expr.Select select_expr = 5;
- Specified by:
getSelectExpr
in interfaceExprOrBuilder
- Returns:
- The selectExpr.
-
getSelectExprOrBuilder
public Expr.SelectOrBuilder getSelectExprOrBuilder()
A field selection expression, e.g. `request.auth`.
.cel.expr.Expr.Select select_expr = 5;
- Specified by:
getSelectExprOrBuilder
in interfaceExprOrBuilder
-
hasCallExpr
public boolean hasCallExpr()
A call expression, including calls to predefined functions and operators.
.cel.expr.Expr.Call call_expr = 6;
- Specified by:
hasCallExpr
in interfaceExprOrBuilder
- Returns:
- Whether the callExpr field is set.
-
getCallExpr
public Expr.Call getCallExpr()
A call expression, including calls to predefined functions and operators.
.cel.expr.Expr.Call call_expr = 6;
- Specified by:
getCallExpr
in interfaceExprOrBuilder
- Returns:
- The callExpr.
-
getCallExprOrBuilder
public Expr.CallOrBuilder getCallExprOrBuilder()
A call expression, including calls to predefined functions and operators.
.cel.expr.Expr.Call call_expr = 6;
- Specified by:
getCallExprOrBuilder
in interfaceExprOrBuilder
-
hasListExpr
public boolean hasListExpr()
A list creation expression.
.cel.expr.Expr.CreateList list_expr = 7;
- Specified by:
hasListExpr
in interfaceExprOrBuilder
- Returns:
- Whether the listExpr field is set.
-
getListExpr
public Expr.CreateList getListExpr()
A list creation expression.
.cel.expr.Expr.CreateList list_expr = 7;
- Specified by:
getListExpr
in interfaceExprOrBuilder
- Returns:
- The listExpr.
-
getListExprOrBuilder
public Expr.CreateListOrBuilder getListExprOrBuilder()
A list creation expression.
.cel.expr.Expr.CreateList list_expr = 7;
- Specified by:
getListExprOrBuilder
in interfaceExprOrBuilder
-
hasStructExpr
public boolean hasStructExpr()
A map or message creation expression.
.cel.expr.Expr.CreateStruct struct_expr = 8;
- Specified by:
hasStructExpr
in interfaceExprOrBuilder
- Returns:
- Whether the structExpr field is set.
-
getStructExpr
public Expr.CreateStruct getStructExpr()
A map or message creation expression.
.cel.expr.Expr.CreateStruct struct_expr = 8;
- Specified by:
getStructExpr
in interfaceExprOrBuilder
- Returns:
- The structExpr.
-
getStructExprOrBuilder
public Expr.CreateStructOrBuilder getStructExprOrBuilder()
A map or message creation expression.
.cel.expr.Expr.CreateStruct struct_expr = 8;
- Specified by:
getStructExprOrBuilder
in interfaceExprOrBuilder
-
hasComprehensionExpr
public boolean hasComprehensionExpr()
A comprehension expression.
.cel.expr.Expr.Comprehension comprehension_expr = 9;
- Specified by:
hasComprehensionExpr
in interfaceExprOrBuilder
- Returns:
- Whether the comprehensionExpr field is set.
-
getComprehensionExpr
public Expr.Comprehension getComprehensionExpr()
A comprehension expression.
.cel.expr.Expr.Comprehension comprehension_expr = 9;
- Specified by:
getComprehensionExpr
in interfaceExprOrBuilder
- Returns:
- The comprehensionExpr.
-
getComprehensionExprOrBuilder
public Expr.ComprehensionOrBuilder getComprehensionExprOrBuilder()
A comprehension expression.
.cel.expr.Expr.Comprehension comprehension_expr = 9;
- Specified by:
getComprehensionExprOrBuilder
in interfaceExprOrBuilder
-
isInitialized
public final boolean isInitialized()
Description copied from interface:MessageLiteOrBuilder
Returns true if all required fields in the message and all embedded messages are set, false otherwise.- Specified by:
isInitialized
in interfaceMessageLiteOrBuilder
- Overrides:
isInitialized
in classGeneratedMessageV3
-
writeTo
public void writeTo(CodedOutputStream output) throws java.io.IOException
Description copied from interface:MessageLite
Serializes the message and writes it tooutput
. This does not flush or close the stream.- Specified by:
writeTo
in interfaceMessageLite
- Overrides:
writeTo
in classGeneratedMessageV3
- Throws:
java.io.IOException
-
getSerializedSize
public int getSerializedSize()
Description copied from interface:MessageLite
Get the number of bytes required to encode this message. The result is only computed on the first call and memoized after that. If this message requires more than Integer.MAX_VALUE bytes to encode, the return value will be smaller than the actual number of bytes required and might be negative.- Specified by:
getSerializedSize
in interfaceMessageLite
- Overrides:
getSerializedSize
in classGeneratedMessageV3
-
equals
public boolean equals(java.lang.Object obj)
Description copied from interface:Message
Compares the specified object with this message for equality. Returnstrue
if the given object is a message of the same type (as defined bygetDescriptorForType()
) and has identical values for all of its fields. Subclasses must implement this; inheritingObject.equals()
is incorrect.- Specified by:
equals
in interfaceMessage
- Overrides:
equals
in classAbstractMessage
- Parameters:
obj
- object to be compared for equality with this message- Returns:
true
if the specified object is equal to this message
-
hashCode
public int hashCode()
Description copied from interface:Message
Returns the hash code value for this message. The hash code of a message should mix the message's type (object identity of the descriptor) with its contents (known and unknown field values). Subclasses must implement this; inheritingObject.hashCode()
is incorrect.- Specified by:
hashCode
in interfaceMessage
- Overrides:
hashCode
in classAbstractMessage
- Returns:
- the hash code value for this message
- See Also:
Map.hashCode()
-
parseFrom
public static Expr parseFrom(java.nio.ByteBuffer data) throws InvalidProtocolBufferException
- Throws:
InvalidProtocolBufferException
-
parseFrom
public static Expr parseFrom(java.nio.ByteBuffer data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
- Throws:
InvalidProtocolBufferException
-
parseFrom
public static Expr parseFrom(ByteString data) throws InvalidProtocolBufferException
- Throws:
InvalidProtocolBufferException
-
parseFrom
public static Expr parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
- Throws:
InvalidProtocolBufferException
-
parseFrom
public static Expr parseFrom(byte[] data) throws InvalidProtocolBufferException
- Throws:
InvalidProtocolBufferException
-
parseFrom
public static Expr parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
- Throws:
InvalidProtocolBufferException
-
parseFrom
public static Expr parseFrom(java.io.InputStream input) throws java.io.IOException
- Throws:
java.io.IOException
-
parseFrom
public static Expr parseFrom(java.io.InputStream input, ExtensionRegistryLite extensionRegistry) throws java.io.IOException
- Throws:
java.io.IOException
-
parseDelimitedFrom
public static Expr parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException
- Throws:
java.io.IOException
-
parseDelimitedFrom
public static Expr parseDelimitedFrom(java.io.InputStream input, ExtensionRegistryLite extensionRegistry) throws java.io.IOException
- Throws:
java.io.IOException
-
parseFrom
public static Expr parseFrom(CodedInputStream input) throws java.io.IOException
- Throws:
java.io.IOException
-
parseFrom
public static Expr parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws java.io.IOException
- Throws:
java.io.IOException
-
newBuilderForType
public Expr.Builder newBuilderForType()
Description copied from interface:MessageLite
Constructs a new builder for a message of the same type as this message.- Specified by:
newBuilderForType
in interfaceMessage
- Specified by:
newBuilderForType
in interfaceMessageLite
-
newBuilder
public static Expr.Builder newBuilder()
-
newBuilder
public static Expr.Builder newBuilder(Expr prototype)
-
toBuilder
public Expr.Builder toBuilder()
Description copied from interface:MessageLite
Constructs a builder initialized with the current message. Use this to derive a new message from the current one.- Specified by:
toBuilder
in interfaceMessage
- Specified by:
toBuilder
in interfaceMessageLite
-
newBuilderForType
protected Expr.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
Description copied from class:GeneratedMessageV3
TODO(xiaofeng): remove this together with GeneratedMessageV3.BuilderParent.- Specified by:
newBuilderForType
in classGeneratedMessageV3
-
getDefaultInstance
public static Expr getDefaultInstance()
-
getParserForType
public Parser<Expr> getParserForType()
Description copied from interface:MessageLite
Gets the parser for a message of the same type as this message.- Specified by:
getParserForType
in interfaceMessage
- Specified by:
getParserForType
in interfaceMessageLite
- Overrides:
getParserForType
in classGeneratedMessageV3
-
getDefaultInstanceForType
public Expr getDefaultInstanceForType()
Description copied from interface:MessageLiteOrBuilder
Get an instance of the type with no fields set. Because no fields are set, all getters for singular fields will return default values and repeated fields will appear empty. This may or may not be a singleton. This differs from thegetDefaultInstance()
method of generated message classes in that this method is an abstract method of theMessageLite
interface whereasgetDefaultInstance()
is a static method of a specific class. They return the same thing.- Specified by:
getDefaultInstanceForType
in interfaceMessageLiteOrBuilder
- Specified by:
getDefaultInstanceForType
in interfaceMessageOrBuilder
-
-