Package dev.cel.common.ast
Class CelConstant
- java.lang.Object
-
- dev.cel.common.ast.CelConstant
-
@Internal @Immutable public abstract class CelConstant extends java.lang.Object
Represents a primitive literal.This is the CEL-Java native type equivalent of Constant message type from syntax.proto.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CelConstant.CelConstantNotSet
An unset constant.static class
CelConstant.Kind
Represents the type of the Constant
-
Constructor Summary
Constructors Constructor Description CelConstant()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description abstract boolean
booleanValue()
abstract com.google.protobuf.ByteString
bytesValue()
abstract double
doubleValue()
abstract com.google.protobuf.Duration
durationValue()
Deprecated.Do not use.abstract CelConstant.Kind
getKind()
abstract long
int64Value()
static boolean
isConstantValue(java.lang.Object value)
Checks whether the provided Java object is a valid CelConstant value.abstract CelConstant.CelConstantNotSet
notSet()
abstract com.google.protobuf.NullValue
nullValue()
static CelConstant
ofNotSet()
static CelConstant
ofObjectValue(java.lang.Object value)
Converts the given Java object into a CelConstant value.static CelConstant
ofValue(boolean value)
static CelConstant
ofValue(double value)
static CelConstant
ofValue(long value)
static CelConstant
ofValue(com.google.common.primitives.UnsignedLong value)
static CelConstant
ofValue(com.google.protobuf.ByteString value)
static CelConstant
ofValue(com.google.protobuf.Duration value)
Deprecated.Do not use.static CelConstant
ofValue(com.google.protobuf.NullValue value)
static CelConstant
ofValue(com.google.protobuf.Timestamp value)
Deprecated.Do not use.static CelConstant
ofValue(java.lang.String value)
abstract java.lang.String
stringValue()
abstract com.google.protobuf.Timestamp
timestampValue()
Deprecated.Do not use.abstract com.google.common.primitives.UnsignedLong
uint64Value()
-
-
-
Method Detail
-
getKind
public abstract CelConstant.Kind getKind()
-
notSet
public abstract CelConstant.CelConstantNotSet notSet()
-
nullValue
public abstract com.google.protobuf.NullValue nullValue()
-
booleanValue
public abstract boolean booleanValue()
-
int64Value
public abstract long int64Value()
-
uint64Value
public abstract com.google.common.primitives.UnsignedLong uint64Value()
-
doubleValue
public abstract double doubleValue()
-
stringValue
public abstract java.lang.String stringValue()
-
bytesValue
public abstract com.google.protobuf.ByteString bytesValue()
-
timestampValue
@Deprecated public abstract com.google.protobuf.Timestamp timestampValue()
Deprecated.Do not use. Timestamp is no longer built-in CEL type.
-
durationValue
@Deprecated public abstract com.google.protobuf.Duration durationValue()
Deprecated.Do not use. Duration is no longer built-in CEL type.
-
ofNotSet
public static CelConstant ofNotSet()
-
ofValue
public static CelConstant ofValue(com.google.protobuf.NullValue value)
-
ofValue
public static CelConstant ofValue(boolean value)
-
ofValue
public static CelConstant ofValue(long value)
-
ofValue
public static CelConstant ofValue(com.google.common.primitives.UnsignedLong value)
-
ofValue
public static CelConstant ofValue(double value)
-
ofValue
public static CelConstant ofValue(java.lang.String value)
-
ofValue
public static CelConstant ofValue(com.google.protobuf.ByteString value)
-
isConstantValue
public static boolean isConstantValue(java.lang.Object value)
Checks whether the provided Java object is a valid CelConstant value.
-
ofObjectValue
public static CelConstant ofObjectValue(java.lang.Object value)
Converts the given Java object into a CelConstant value. This is equivalent of callingofValue(com.google.protobuf.NullValue)
with concrete types.- Throws:
java.lang.IllegalArgumentException
- If the value is not a supported CelConstant. This includes the deprecated duration and timestamp values.
-
ofValue
@Deprecated public static CelConstant ofValue(com.google.protobuf.Duration value)
Deprecated.Do not use. Duration is no longer built-in CEL type.
-
ofValue
@Deprecated public static CelConstant ofValue(com.google.protobuf.Timestamp value)
Deprecated.Do not use. Timestamp is no longer built-in CEL type.
-
-