Class RuntimeTypeProviderLegacyImpl

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object adapt​(java.lang.Object message)
      Adapt object to its message value with source location metadata on failure .
      @Nullable Value adaptType​(@Nullable Type type)
      Adapt the check-time type instance to a runtime Value.
      Value adaptType​(CelType type)
      Adapt the check-time type instance to a runtime Value.
      java.lang.Object createMessage​(java.lang.String messageName, java.util.Map<java.lang.String,​java.lang.Object> values)
      Create a message based on the fully qualified message name and field-value mapping.
      java.lang.Object hasField​(java.lang.Object message, java.lang.String fieldName)
      Check whether a field is set on message.
      Value resolveObjectType​(java.lang.Object obj, Value checkedTypeValue)
      Resolve the CEL type of the obj, using the checkedTypeValue as hint for type disambiguation.
      java.lang.Object selectField​(java.lang.Object message, java.lang.String fieldName)
      Select field from message.
      • Methods inherited from class java.lang.Object

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

      • createMessage

        public java.lang.Object createMessage​(java.lang.String messageName,
                                              java.util.Map<java.lang.String,​java.lang.Object> values)
        Description copied from interface: MessageProvider
        Create a message based on the fully qualified message name and field-value mapping.
        Specified by:
        createMessage in interface MessageProvider
      • selectField

        public java.lang.Object selectField​(java.lang.Object message,
                                            java.lang.String fieldName)
        Description copied from interface: MessageProvider
        Select field from message.
        Specified by:
        selectField in interface MessageProvider
      • hasField

        public java.lang.Object hasField​(java.lang.Object message,
                                         java.lang.String fieldName)
        Description copied from interface: MessageProvider
        Check whether a field is set on message.
        Specified by:
        hasField in interface MessageProvider
      • adapt

        public java.lang.Object adapt​(java.lang.Object message)
        Description copied from interface: MessageProvider
        Adapt object to its message value with source location metadata on failure .
        Specified by:
        adapt in interface MessageProvider
      • resolveObjectType

        public Value resolveObjectType​(java.lang.Object obj,
                                       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 Value adaptType​(CelType type)
        Description copied from interface: TypeResolver
        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

        public @Nullable Value adaptType​(@Nullable Type type)
        Description copied from interface: TypeResolver
        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