Class CelTypes


  • public final class CelTypes
    extends java.lang.Object
    Utility class for working with Type.
    • Field Detail

      • DURATION_MESSAGE

        public static final java.lang.String DURATION_MESSAGE
        See Also:
        Constant Field Values
      • LIST_VALUE_MESSAGE

        public static final java.lang.String LIST_VALUE_MESSAGE
        See Also:
        Constant Field Values
      • TIMESTAMP_MESSAGE

        public static final java.lang.String TIMESTAMP_MESSAGE
        See Also:
        Constant Field Values
      • BOOL_WRAPPER_MESSAGE

        public static final java.lang.String BOOL_WRAPPER_MESSAGE
        See Also:
        Constant Field Values
      • BYTES_WRAPPER_MESSAGE

        public static final java.lang.String BYTES_WRAPPER_MESSAGE
        See Also:
        Constant Field Values
      • DOUBLE_WRAPPER_MESSAGE

        public static final java.lang.String DOUBLE_WRAPPER_MESSAGE
        See Also:
        Constant Field Values
      • FLOAT_WRAPPER_MESSAGE

        public static final java.lang.String FLOAT_WRAPPER_MESSAGE
        See Also:
        Constant Field Values
      • INT32_WRAPPER_MESSAGE

        public static final java.lang.String INT32_WRAPPER_MESSAGE
        See Also:
        Constant Field Values
      • INT64_WRAPPER_MESSAGE

        public static final java.lang.String INT64_WRAPPER_MESSAGE
        See Also:
        Constant Field Values
      • STRING_WRAPPER_MESSAGE

        public static final java.lang.String STRING_WRAPPER_MESSAGE
        See Also:
        Constant Field Values
      • UINT32_WRAPPER_MESSAGE

        public static final java.lang.String UINT32_WRAPPER_MESSAGE
        See Also:
        Constant Field Values
      • UINT64_WRAPPER_MESSAGE

        public static final java.lang.String UINT64_WRAPPER_MESSAGE
        See Also:
        Constant Field Values
      • ERROR

        public static final Type ERROR
      • DYN

        public static final Type DYN
      • NULL_TYPE

        public static final Type NULL_TYPE
      • BOOL

        public static final Type BOOL
      • BYTES

        public static final Type BYTES
      • STRING

        public static final Type STRING
      • DOUBLE

        public static final Type DOUBLE
      • UINT64

        public static final Type UINT64
      • INT64

        public static final Type INT64
      • ANY

        public static final Type ANY
      • TIMESTAMP

        public static final Type TIMESTAMP
      • DURATION

        public static final Type DURATION
    • Method Detail

      • create

        public static Type create​(Type target)
        Create a type Type.
      • createList

        public static Type createList​(Type elemType)
        Create a list with elemType.
      • createMap

        public static Type createMap​(Type keyType,
                                     Type valueType)
        Create a map with keyType and valueType.
      • createMessage

        public static Type createMessage​(java.lang.String messageName)
        Create a message Type for messageName.
      • createTypeParam

        public static Type createTypeParam​(java.lang.String name)
        Create a type param Type.
      • createWrapper

        public static Type createWrapper​(Type.PrimitiveType primitive)
        Create a wrapper type for the primitive.
      • createWrapper

        public static Type createWrapper​(Type type)
        Create a wrapper type where the input is a Type of primitive types.
      • isWrapperType

        public static boolean isWrapperType​(java.lang.String typeName)
        Checks if the fully-qualified protobuf type name is a wrapper type.
      • createOptionalType

        public static Type createOptionalType​(Type paramType)
        Create an abstract type indicating that the parameterized type may be contained within the object.
      • isOptionalType

        public static boolean isOptionalType​(Type type)
        Checks if the provided parameter is an optional type
      • createFunctionType

        @Internal
        public static OpaqueType createFunctionType​(CelType resultType,
                                                    java.lang.Iterable<CelType> argumentTypes)
        Create an abstract type with an expected result type (first argument in the parameter) and the argument types.

        CEL Library Internals. Do Not Use.

      • formatFunction

        public static java.lang.String formatFunction​(CelType resultType,
                                                      java.lang.Iterable<CelType> argTypes,
                                                      boolean isInstance,
                                                      boolean typeParamToDyn)
        Format a function signature string from the input argTypes and resultType.

        When isInstance is true, the argTypes[0] type is used as the receiver type.

        When resultType is null, the function signature omits the result type. This is useful for computing overload signatures.

        When typeParamToDyn is true, parameterized type argument are represented as Types.DYN values.

      • isWellKnownType

        public static boolean isWellKnownType​(java.lang.String typeName)
      • getWellKnownCelType

        public static java.util.Optional<CelType> getWellKnownCelType​(java.lang.String typeName)
      • celTypeToType

        @Internal
        public static Type celTypeToType​(CelType celType)
        Converts a Protobuf type into CEL native type.
      • typeToCelType

        @Internal
        public static CelType typeToCelType​(Type type)
        Converts a Protobuf type to CEL native type.