Class CelType

  • Direct Known Subclasses:
    EnumType, ListType, MapType, NullableType, OpaqueType, OptionalType, SimpleType, StructType, StructTypeReference, TypeParamType, TypeType

    @Immutable
    @CheckReturnValue
    public abstract class CelType
    extends java.lang.Object
    Abstract representation of a CEL type which indicates its CelKind, name, and parameters.

    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
      protected CelType()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isAssignableFrom​(CelType other)
      Determine whether this type is assignable from the other type value.
      abstract CelKind kind()
      Return the type CelKind.
      abstract java.lang.String name()
      Return the type name.
      com.google.common.collect.ImmutableList<CelType> parameters()
      Return the type parameters.
      CelType withFreshTypeParamVariables​(java.util.function.Function<java.lang.String,​java.lang.String> varNameGenerator)
      Instantiate a new copy of this type with alternative parameters.
      CelType withParameters​(com.google.common.collect.ImmutableList<CelType> parameters)
      Instantiate a new copy of this type with alternative parameters.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CelType

        protected CelType()
    • Method Detail

      • kind

        public abstract CelKind kind()
        Return the type CelKind.
      • 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 value CelType.
      • isAssignableFrom

        public boolean isAssignableFrom​(CelType other)
        Determine whether this type is assignable from the other type 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 alternative parameters.

        If the CelType does not have any parameters, 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 alternative parameters.

        If the CelType does not have any parameters, then the return value defaults to the original type instance.