Class CelTypes
- java.lang.Object
-
- dev.cel.common.types.CelTypes
-
public final class CelTypes extends java.lang.ObjectUtility class for working withType.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeANYstatic java.lang.StringANY_MESSAGEstatic TypeBOOLstatic java.lang.StringBOOL_WRAPPER_MESSAGEstatic TypeBYTESstatic java.lang.StringBYTES_WRAPPER_MESSAGEstatic TypeDOUBLEstatic java.lang.StringDOUBLE_WRAPPER_MESSAGEstatic TypeDURATIONstatic java.lang.StringDURATION_MESSAGEstatic TypeDYNstatic TypeERRORstatic java.lang.StringFLOAT_WRAPPER_MESSAGEstatic java.lang.StringINT32_WRAPPER_MESSAGEstatic TypeINT64static java.lang.StringINT64_WRAPPER_MESSAGEstatic java.lang.StringLIST_VALUE_MESSAGEstatic TypeNULL_TYPEstatic TypeSTRINGstatic java.lang.StringSTRING_WRAPPER_MESSAGEstatic java.lang.StringSTRUCT_MESSAGEstatic TypeTIMESTAMPstatic java.lang.StringTIMESTAMP_MESSAGEstatic java.lang.StringUINT32_WRAPPER_MESSAGEstatic TypeUINT64static java.lang.StringUINT64_WRAPPER_MESSAGEstatic java.lang.StringVALUE_MESSAGE
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static TypecelTypeToType(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 OpaqueTypecreateFunctionType(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.static TypecreateList(Type elemType)Create a list withelemType.static TypecreateMap(Type keyType, Type valueType)Create a map withkeyTypeandvalueType.static TypecreateMessage(Descriptors.Descriptor descriptor)Create a messageTypeforDescriptor.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(CelType type)Method to adapt a simpleTypeinto aStringrepresentation.static java.lang.Stringformat(Type type)Deprecated.Useformat(CelType)instead.static java.lang.StringformatFunction(CelType resultType, java.lang.Iterable<CelType> argTypes, boolean isInstance, boolean typeParamToDyn)Format a function signature string from the inputargTypesandresultType.static java.util.Optional<CelType>getWellKnownCelType(java.lang.String typeName)static booleanisOptionalType(Type type)Checks if the provided parameter is an optional typestatic booleanisWellKnownType(java.lang.String typeName)static booleanisWrapperType(java.lang.String typeName)Checks if the fully-qualified protobuf type name is a wrapper type.static CelTypetypeToCelType(Type type)Converts a Protobuf type to CEL native type.
-
-
-
Field Detail
-
ANY_MESSAGE
public static final java.lang.String ANY_MESSAGE
- See Also:
- Constant Field Values
-
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
-
STRUCT_MESSAGE
public static final java.lang.String STRUCT_MESSAGE
- See Also:
- Constant Field Values
-
TIMESTAMP_MESSAGE
public static final java.lang.String TIMESTAMP_MESSAGE
- See Also:
- Constant Field Values
-
VALUE_MESSAGE
public static final java.lang.String VALUE_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.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.
-
createMessage
public static Type createMessage(Descriptors.Descriptor descriptor)
Create a messageTypeforDescriptor.
-
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.
-
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.
-
format
@Deprecated public static java.lang.String format(Type type)
Deprecated.Useformat(CelType)instead.Method to adapt a simpleTypeinto aStringrepresentation.This method can also format global functions. See the
formatFunction(dev.cel.common.types.CelType, java.lang.Iterable<dev.cel.common.types.CelType>, boolean, boolean)methods for richer control over function formatting.
-
format
public static java.lang.String format(CelType type)
Method to adapt a simpleTypeinto aStringrepresentation.This method can also format global functions. See the
formatFunction(dev.cel.common.types.CelType, java.lang.Iterable<dev.cel.common.types.CelType>, boolean, boolean)methods for richer control over function formatting.
-
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 inputargTypesandresultType.When
isInstanceistrue, theargTypes[0]type is used as the receiver type.When
resultTypeisnull, the function signature omits the result type. This is useful for computing overload signatures.When
typeParamToDynistrue, parameterized type argument are represented asTypes.DYNvalues.
-
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.
-
-