Class CelProtoTypes


  • public final class CelProtoTypes
    extends java.lang.Object
    Utility class for working with Type.

    This is equivalent to CelTypes, except this works specifically with canonical CEL expr protos.

    • Field Detail

      • 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.
      • 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
      • format

        public static java.lang.String format​(Type type)
        Method to adapt a simple Type into a String representation.

        This method can also format global functions. See the CelTypes.formatFunction(dev.cel.common.types.CelType, java.lang.Iterable<dev.cel.common.types.CelType>, boolean, boolean) methods for richer control over function formatting.

      • celTypeToType

        public static Type celTypeToType​(dev.cel.common.types.CelType celType)
        Converts a Protobuf type into CEL native type.
      • typeToCelType

        public static dev.cel.common.types.CelType typeToCelType​(Type type)
        Converts a Protobuf type to CEL native type.