Package dev.cel.checker
Class Types
- java.lang.Object
-
- dev.cel.checker.Types
-
-
Field Summary
Fields Modifier and Type Field Description static Type
ANY
static java.lang.String
ANY_MESSAGE
static Type
BOOL
static java.lang.String
BOOL_WRAPPER_MESSAGE
static Type
BYTES
static java.lang.String
BYTES_WRAPPER_MESSAGE
static Type
DOUBLE
static java.lang.String
DOUBLE_WRAPPER_MESSAGE
static Type
DURATION
static java.lang.String
DURATION_MESSAGE
static Type
DYN
static Type
ERROR
static java.lang.String
FLOAT_WRAPPER_MESSAGE
static java.lang.String
INT32_WRAPPER_MESSAGE
static Type
INT64
static java.lang.String
INT64_WRAPPER_MESSAGE
static java.lang.String
LIST_VALUE_MESSAGE
static Type
NULL_TYPE
static Type
STRING
static java.lang.String
STRING_WRAPPER_MESSAGE
static java.lang.String
STRUCT_MESSAGE
static Type
TIMESTAMP
static java.lang.String
TIMESTAMP_MESSAGE
static java.lang.String
UINT32_WRAPPER_MESSAGE
static Type
UINT64
static java.lang.String
UINT64_WRAPPER_MESSAGE
static java.lang.String
VALUE_MESSAGE
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static Type
create(Type target)
Create a typeType
.static Type
create(Type.PrimitiveType type)
Create a primitiveType
.static Type
create(Type.WellKnownType type)
Create a well-knownType
.static Type
createList(Type elemType)
Create a list withelemType
.static Type
createMap(Type keyType, Type valueType)
Create a map withkeyType
andvalueType
.static Type
createMessage(java.lang.String messageName)
Create a messageType
formessageName
.static Type
createTypeParam(java.lang.String name)
Create a type paramType
.static Type
createWrapper(Type type)
Create a wrapper type where the input is aType
of primitive types.static Type
createWrapper(Type.PrimitiveType primitive)
Create a wrapper type for theprimitive
.static @Nullable java.util.Map<CelType,CelType>
isAssignable(java.util.Map<CelType,CelType> subs, CelType type1, CelType type2)
Checks whether type1 is assignable to type2, based on the given substitution for type parameters.static @Nullable java.util.Map<CelType,CelType>
isAssignable(java.util.Map<CelType,CelType> subs, java.util.List<CelType> list1, java.util.List<CelType> list2)
Same asisAssignable(Map, Type, Type)
but performs pairwise check on lists of types.static @Nullable java.util.Map<Type,Type>
isAssignable(java.util.Map<Type,Type> subs, Type type1, Type type2)
Deprecated.UseisAssignable(Map, CelType, CelType)
instead.static boolean
isDyn(CelType type)
static boolean
isDynOrError(CelType type)
Tests whether the type has error or dyn kind.static boolean
isDynOrError(Type type)
Deprecated.Use {isDynOrError(CelType)
} instead.static boolean
isEqualOrLessSpecific(CelType type1, CelType type2)
Check whether one type is equal or less specific than the other one.static boolean
isEqualOrLessSpecific(Type type1, Type type2)
Deprecated.UseisEqualOrLessSpecific(CelType, CelType)
instead.static CelType
mostGeneral(CelType type1, CelType type2)
Returns the more general of two types which are known to unify.static CelType
substitute(java.util.Map<CelType,CelType> subs, CelType type, boolean typeParamToDyn)
Apply substitution to given type, replacing all direct and indirect occurrences of bound type parameters.static Type
substitute(java.util.Map<Type,Type> subs, Type type, boolean typeParamToDyn)
Deprecated.Usesubstitute(Map, CelType, boolean)
instead.
-
-
-
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 withkeyType
andvalueType
.
-
createMessage
public static Type createMessage(java.lang.String messageName)
Create a messageType
formessageName
.
-
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 aType
of primitive types.
-
isDynOrError
@Deprecated public static boolean isDynOrError(Type type)
Deprecated.Use {isDynOrError(CelType)
} instead.Tests whether the type has error or dyn kind. Both have the property to match any type.
-
isDynOrError
public static boolean isDynOrError(CelType type)
Tests whether the type has error or dyn kind. Both have the property to match any type.
-
isDyn
public static boolean isDyn(CelType type)
-
mostGeneral
public static CelType mostGeneral(CelType type1, CelType type2)
Returns the more general of two types which are known to unify.
-
isAssignable
public static @Nullable java.util.Map<CelType,CelType> isAssignable(java.util.Map<CelType,CelType> subs, CelType type1, CelType type2)
Checks whether type1 is assignable to type2, based on the given substitution for type parameters. A new substitution is returned, or null if the check fails. The given substitution is not modified.
-
isAssignable
@Deprecated public static @Nullable java.util.Map<Type,Type> isAssignable(java.util.Map<Type,Type> subs, Type type1, Type type2)
Deprecated.UseisAssignable(Map, CelType, CelType)
instead.Checks whether type1 is assignable to type2, based on the given substitution for type parameters. A new substitution is returned, or null if the check fails. The given substitution is not modified.
-
isAssignable
public static @Nullable java.util.Map<CelType,CelType> isAssignable(java.util.Map<CelType,CelType> subs, java.util.List<CelType> list1, java.util.List<CelType> list2)
Same asisAssignable(Map, Type, Type)
but performs pairwise check on lists of types.
-
isEqualOrLessSpecific
@Deprecated public static boolean isEqualOrLessSpecific(Type type1, Type type2)
Deprecated.UseisEqualOrLessSpecific(CelType, CelType)
instead.Check whether one type is equal or less specific than the other one. A type is less specific if it matches the other type using the DYN type.
-
isEqualOrLessSpecific
public static boolean isEqualOrLessSpecific(CelType type1, CelType type2)
Check whether one type is equal or less specific than the other one. A type is less specific if it matches the other type using the DYN type.
-
substitute
@Deprecated public static Type substitute(java.util.Map<Type,Type> subs, Type type, boolean typeParamToDyn)
Deprecated.Usesubstitute(Map, CelType, boolean)
instead.Apply substitution to given type, replacing all direct and indirect occurrences of bound type parameters. Unbound type parameters are replaced by DYN if typeParamToDyn is true.
-
-