Class StandardTypeResolver

  • All Implemented Interfaces:
    TypeResolver

    @Immutable
    @Internal
    public final class StandardTypeResolver
    extends java.lang.Object
    implements TypeResolver
    The StandardTypeResolver implements the TypeResolver and resolves types supported by the CEL standard environment.

    CEL Library Internals. Do Not Use.

    • Method Detail

      • resolveObjectType

        public @Nullable Value resolveObjectType​(java.lang.Object obj,
                                                 @Nullable Value checkedTypeValue)
        Description copied from interface: TypeResolver
        Resolve the CEL type of the obj, using the checkedTypeValue as hint for type disambiguation.

        The checkedTypeValue indicates the statically determined type of the object at check-time. Often, the check-time and runtime phases agree, but there are cases where the runtime type is ambiguous, as is the case when a Long value is supplied as this could either be an int, uint, or enum type.

        Type resolution is biased toward the runtime value type, given the dynamically typed nature of CEL.

        Specified by:
        resolveObjectType in interface TypeResolver
      • adaptType

        public @Nullable Value adaptType​(CelType type)
        Adapt the check-time type instance to a runtime Value.

        When the checked type does not have a runtime equivalent, e.g. Type#DYN, the return value will be null.

        Specified by:
        adaptType in interface TypeResolver
      • adaptType

        @Deprecated
        public @Nullable Value adaptType​(@Nullable Type type)
        Deprecated.
        Adapt the check-time type instance to a runtime Value.

        When the checked type does not have a runtime equivalent, e.g. Type#DYN, the return value will be null.

        Specified by:
        adaptType in interface TypeResolver