Package dev.cel.common.types
Class CelType
- java.lang.Object
-
- dev.cel.common.types.CelType
-
- Direct Known Subclasses:
EnumType,ListType,MapType,NullableType,OpaqueType,OptionalType,SimpleType,StructType,StructTypeReference,TypeParamType,TypeType,UnspecifiedType
@Immutable @CheckReturnValue public abstract class CelType extends java.lang.ObjectAbstract representation of a CEL type which indicates itsCelKind,name, andparameters.Each type also exposes functions to generate a copy of the type containing fresh type variables, and a function for generating a new instance of the type with a different set of type parameters. These functions are critical for making type inferences.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedCelType()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanisAssignableFrom(CelType other)Determine whetherthistype is assignable from theothertype value.abstract CelKindkind()Return the typeCelKind.abstract java.lang.Stringname()Return the type name.com.google.common.collect.ImmutableList<CelType>parameters()Return the type parameters.CelTypewithFreshTypeParamVariables(java.util.function.Function<java.lang.String,java.lang.String> varNameGenerator)Instantiate a new copy of this type with alternativeparameters.CelTypewithParameters(com.google.common.collect.ImmutableList<CelType> parameters)Instantiate a new copy of this type with alternativeparameters.
-
-
-
Method Detail
-
kind
public abstract CelKind kind()
Return the typeCelKind.
-
name
public abstract java.lang.String name()
Return the type name.For struct types this should be the fully qualified name. Be wary of introducing unqualified type names as they may collide with future CEL type.
-
parameters
public com.google.common.collect.ImmutableList<CelType> parameters()
Return the type parameters. e.g. a map's key and valueCelType.
-
isAssignableFrom
public boolean isAssignableFrom(CelType other)
Determine whetherthistype is assignable from theothertype value.Defaults to an equality test.
-
withParameters
@CanIgnoreReturnValue public CelType withParameters(com.google.common.collect.ImmutableList<CelType> parameters)
Instantiate a new copy of this type with alternativeparameters.If the
CelTypedoes not have anyparameters, then the return value defaults to the original type instance.
-
withFreshTypeParamVariables
@CanIgnoreReturnValue public CelType withFreshTypeParamVariables(java.util.function.Function<java.lang.String,java.lang.String> varNameGenerator)
Instantiate a new copy of this type with alternativeparameters.If the
CelTypedoes not have anyparameters, then the return value defaults to the original type instance.
-
-