Class EnumType


  • @CheckReturnValue
    public final class EnumType
    extends CelType
    Enum types to support strongly typed enums with lookups by value name and number.
    • Method Detail

      • kind

        public CelKind kind()
        Description copied from class: CelType
        Return the type CelKind.
        Specified by:
        kind in class CelType
      • name

        public java.lang.String name()
        Description copied from class: CelType
        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.

        Specified by:
        name in class CelType
      • isAssignableFrom

        public boolean isAssignableFrom​(CelType other)
        Description copied from class: CelType
        Determine whether this type is assignable from the other type value.

        Defaults to an equality test.

        Overrides:
        isAssignableFrom in class CelType
      • findNumberByName

        public java.util.Optional<java.lang.Integer> findNumberByName​(java.lang.String enumName)
        Find an enum number by enumName.
      • findNameByNumber

        public java.util.Optional<java.lang.String> findNameByNumber​(java.lang.Integer enumNumber)
        Find an enum name by enumNumber.
      • create

        public static EnumType create​(java.lang.String name,
                                      com.google.common.collect.ImmutableMap<java.lang.String,​java.lang.Integer> enumNameToNumber)