Package dev.cel.runtime
Class CelAttribute
- java.lang.Object
-
- dev.cel.runtime.CelAttribute
-
@Immutable public abstract class CelAttribute extends java.lang.Object
CelAttribute represents the select path from the root (.) to a single leaf value that may be derived from the activation (e.g. .com.google.Attribute['index'])This includes fully qualified identifiers and the selection path to a member field or element.
CelAttributes are represented as a list of qualifiers (select/index operations) from the root, e.g. identifier[2].field is represented as string:identifier, int:2, string:field.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CelAttribute.Qualifier
Representation of a single select qualifier or index.
-
Field Summary
Fields Modifier and Type Field Description static CelAttribute
EMPTY
Empty attribute.
-
Constructor Summary
Constructors Constructor Description CelAttribute()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static CelAttribute
create(com.google.common.collect.ImmutableList<CelAttribute.Qualifier> qualifiers)
Creates a CelAttribute.static CelAttribute
create(java.lang.String rootIdentifier)
Creates a CelAttribute from a single root identifier.static CelAttribute
fromQualifiedIdentifier(java.lang.String qualifiedIdentifier)
Attempts to parse a dot qualified identifier into a CEL attribute.abstract com.google.common.collect.ImmutableList<CelAttribute.Qualifier>
qualifiers()
The list of qualifiers representing the select path for this attribute.CelAttribute
qualify(CelAttribute.Qualifier qualifier)
Creates a new attribute that is more qualified (has an additional select or index operation) than the receiver.java.lang.String
toString()
-
-
-
Field Detail
-
EMPTY
public static final CelAttribute EMPTY
Empty attribute. Represents a value that doesn't have a corresponding attribute (e.g. the result of a function).
-
-
Method Detail
-
create
public static CelAttribute create(com.google.common.collect.ImmutableList<CelAttribute.Qualifier> qualifiers)
Creates a CelAttribute.
-
create
public static CelAttribute create(java.lang.String rootIdentifier)
Creates a CelAttribute from a single root identifier.
-
fromQualifiedIdentifier
public static CelAttribute fromQualifiedIdentifier(java.lang.String qualifiedIdentifier)
Attempts to parse a dot qualified identifier into a CEL attribute.- Throws:
java.lang.IllegalArgumentException
- if qualifiedIdentifier isn't a legal qualified identifier. Note: this is intended for use with reference names in a checked CEL expression -- it does not check for some edge cases (e.g. reserved words).
-
qualifiers
public abstract com.google.common.collect.ImmutableList<CelAttribute.Qualifier> qualifiers()
The list of qualifiers representing the select path for this attribute.
-
qualify
public CelAttribute qualify(CelAttribute.Qualifier qualifier)
Creates a new attribute that is more qualified (has an additional select or index operation) than the receiver.
-
toString
public final java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-