Package dev.cel.common.types
Class CelProtoTypes
- java.lang.Object
-
- dev.cel.common.types.CelProtoTypes
-
public final class CelProtoTypes extends java.lang.ObjectUtility class for working withType.This is equivalent to
CelTypes, except this works specifically with canonical CEL expr protos.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static TypecelTypeToType(dev.cel.common.types.CelType celType)Converts a Protobuf type into CEL native type.static Typecreate(Type target)Create a typeType.static Typecreate(Type.PrimitiveType type)Create a primitiveType.static Typecreate(Type.WellKnownType type)Create a well-knownType.static TypecreateList(Type elemType)Create a list withelemType.static TypecreateMap(Type keyType, Type valueType)Create a map withkeyTypeandvalueType.static TypecreateMessage(java.lang.String messageName)Create a messageTypeformessageName.static TypecreateOptionalType(Type paramType)Create an abstract type indicating that the parameterized type may be contained within the object.static TypecreateTypeParam(java.lang.String name)Create a type paramType.static TypecreateWrapper(Type type)Create a wrapper type where the input is aTypeof primitive types.static TypecreateWrapper(Type.PrimitiveType primitive)Create a wrapper type for theprimitive.static java.lang.Stringformat(Type type)Method to adapt a simpleTypeinto aStringrepresentation.static booleanisOptionalType(Type type)Checks if the provided parameter is an optional typestatic dev.cel.common.types.CelTypetypeToCelType(Type type)Converts a Protobuf type to CEL native type.
-
-
-
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.PrimitiveType type)
Create a primitiveType.
-
create
public static Type create(Type.WellKnownType type)
Create a well-knownType.
-
createMap
public static Type createMap(Type keyType, Type valueType)
Create a map withkeyTypeandvalueType.
-
createMessage
public static Type createMessage(java.lang.String messageName)
Create a messageTypeformessageName.
-
createTypeParam
public static Type createTypeParam(java.lang.String name)
Create a type paramType.
-
createWrapper
public static Type createWrapper(Type.PrimitiveType primitive)
Create a wrapper type for theprimitive.
-
createWrapper
public static Type createWrapper(Type type)
Create a wrapper type where the input is aTypeof 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 simpleTypeinto aStringrepresentation.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.
-
-