Package dev.cel.common.types
Class CelTypes
- java.lang.Object
-
- dev.cel.common.types.CelTypes
-
public final class CelTypes extends java.lang.ObjectUtility class for working withCelType.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringANY_MESSAGEstatic java.lang.StringBOOL_WRAPPER_MESSAGEstatic java.lang.StringBYTES_WRAPPER_MESSAGEstatic java.lang.StringDOUBLE_WRAPPER_MESSAGEstatic java.lang.StringDURATION_MESSAGEstatic java.lang.StringFLOAT_WRAPPER_MESSAGEstatic java.lang.StringINT32_WRAPPER_MESSAGEstatic java.lang.StringINT64_WRAPPER_MESSAGEstatic java.lang.StringLIST_VALUE_MESSAGEstatic java.lang.StringSTRING_WRAPPER_MESSAGEstatic java.lang.StringSTRUCT_MESSAGEstatic java.lang.StringTIMESTAMP_MESSAGEstatic java.lang.StringUINT32_WRAPPER_MESSAGEstatic java.lang.StringUINT64_WRAPPER_MESSAGEstatic java.lang.StringVALUE_MESSAGE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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 java.lang.Stringformat(CelType type)Method to adapt a simpleTypeinto aStringrepresentation.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 booleanisWellKnownType(java.lang.String typeName)static booleanisWrapperType(java.lang.String typeName)Checks if the fully-qualified protobuf type name is a wrapper 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
-
-
Method Detail
-
isWrapperType
public static boolean isWrapperType(java.lang.String typeName)
Checks if the fully-qualified protobuf type name is a wrapper 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
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)
-
-