Package dev.cel.checker
Class Types
- java.lang.Object
-
- dev.cel.checker.Types
-
@Internal public final class Types extends java.lang.ObjectUtilities for dealing with theTypeproto.CEL Library Internals. Do Not Use.
-
-
Field Summary
Fields Modifier and Type Field Description static dev.cel.expr.TypeANYstatic java.lang.StringANY_MESSAGEstatic dev.cel.expr.TypeBOOLstatic java.lang.StringBOOL_WRAPPER_MESSAGEstatic dev.cel.expr.TypeBYTESstatic java.lang.StringBYTES_WRAPPER_MESSAGEstatic dev.cel.expr.TypeDOUBLEstatic java.lang.StringDOUBLE_WRAPPER_MESSAGEstatic dev.cel.expr.TypeDURATIONstatic java.lang.StringDURATION_MESSAGEstatic dev.cel.expr.TypeDYNstatic dev.cel.expr.TypeERRORstatic java.lang.StringFLOAT_WRAPPER_MESSAGEstatic java.lang.StringINT32_WRAPPER_MESSAGEstatic dev.cel.expr.TypeINT64static java.lang.StringINT64_WRAPPER_MESSAGEstatic java.lang.StringLIST_VALUE_MESSAGEstatic dev.cel.expr.TypeNULL_TYPEstatic com.google.common.collect.ImmutableMap<com.google.protobuf.DescriptorProtos.FieldDescriptorProto.Type,dev.cel.expr.Type>PRIMITIVE_TYPE_MAPMap of primitive proto types and their CELTypeequivalents.static dev.cel.expr.TypeSTRINGstatic java.lang.StringSTRING_WRAPPER_MESSAGEstatic java.lang.StringSTRUCT_MESSAGEstatic dev.cel.expr.TypeTIMESTAMPstatic java.lang.StringTIMESTAMP_MESSAGEstatic java.lang.StringUINT32_WRAPPER_MESSAGEstatic dev.cel.expr.TypeUINT64static java.lang.StringUINT64_WRAPPER_MESSAGEstatic java.lang.StringVALUE_MESSAGEstatic com.google.common.collect.ImmutableMap<java.lang.String,dev.cel.expr.Type>WELL_KNOWN_TYPE_MAPMap of well-known proto messages and their CELTypeequivalents.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static dev.cel.expr.Typecreate(dev.cel.expr.Type target)Create a typeType.static dev.cel.expr.Typecreate(dev.cel.expr.Type.PrimitiveType type)Create a primitiveType.static dev.cel.expr.Typecreate(dev.cel.expr.Type.WellKnownType type)Create a well-knownType.static dev.cel.expr.TypecreateList(dev.cel.expr.Type elemType)Create a list withelemType.static dev.cel.expr.TypecreateMap(dev.cel.expr.Type keyType, dev.cel.expr.Type valueType)Create a map withkeyTypeandvalueType.static dev.cel.expr.TypecreateMessage(java.lang.String messageName)Create a messageTypeformessageName.static dev.cel.expr.TypecreateTypeParam(java.lang.String name)Create a type paramType.static dev.cel.expr.TypecreateWrapper(dev.cel.expr.Type type)Create a wrapper type where the input is aTypeof primitive types.static dev.cel.expr.TypecreateWrapper(dev.cel.expr.Type.PrimitiveType primitive)Create a wrapper type for theprimitive.static @Nullable java.util.Map<dev.cel.common.types.CelType,dev.cel.common.types.CelType>isAssignable(java.util.Map<dev.cel.common.types.CelType,dev.cel.common.types.CelType> subs, dev.cel.common.types.CelType type1, dev.cel.common.types.CelType type2)Checks whether type1 is assignable to type2, based on the given substitution for type parameters.static @Nullable java.util.Map<dev.cel.common.types.CelType,dev.cel.common.types.CelType>isAssignable(java.util.Map<dev.cel.common.types.CelType,dev.cel.common.types.CelType> subs, java.util.List<dev.cel.common.types.CelType> list1, java.util.List<dev.cel.common.types.CelType> list2)Same asisAssignable(Map, Type, Type)but performs pairwise check on lists of types.static @Nullable java.util.Map<dev.cel.expr.Type,dev.cel.expr.Type>isAssignable(java.util.Map<dev.cel.expr.Type,dev.cel.expr.Type> subs, dev.cel.expr.Type type1, dev.cel.expr.Type type2)Deprecated.UseisAssignable(Map, CelType, CelType)instead.static booleanisDyn(dev.cel.common.types.CelType type)static booleanisDynOrError(dev.cel.common.types.CelType type)Tests whether the type has error or dyn kind.static booleanisDynOrError(dev.cel.expr.Type type)Deprecated.Use {isDynOrError(CelType)} instead.static booleanisEqualOrLessSpecific(dev.cel.common.types.CelType type1, dev.cel.common.types.CelType type2)Check whether one type is equal or less specific than the other one.static booleanisEqualOrLessSpecific(dev.cel.expr.Type type1, dev.cel.expr.Type type2)Deprecated.UseisEqualOrLessSpecific(CelType, CelType)instead.static dev.cel.common.types.CelTypemostGeneral(dev.cel.common.types.CelType type1, dev.cel.common.types.CelType type2)Returns the more general of two types which are known to unify.static dev.cel.common.types.CelTypesubstitute(java.util.Map<dev.cel.common.types.CelType,dev.cel.common.types.CelType> subs, dev.cel.common.types.CelType type, boolean typeParamToDyn)Apply substitution to given type, replacing all direct and indirect occurrences of bound type parameters.static dev.cel.expr.Typesubstitute(java.util.Map<dev.cel.expr.Type,dev.cel.expr.Type> subs, dev.cel.expr.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 dev.cel.expr.Type ERROR
-
DYN
public static final dev.cel.expr.Type DYN
-
NULL_TYPE
public static final dev.cel.expr.Type NULL_TYPE
-
BOOL
public static final dev.cel.expr.Type BOOL
-
BYTES
public static final dev.cel.expr.Type BYTES
-
STRING
public static final dev.cel.expr.Type STRING
-
DOUBLE
public static final dev.cel.expr.Type DOUBLE
-
UINT64
public static final dev.cel.expr.Type UINT64
-
INT64
public static final dev.cel.expr.Type INT64
-
ANY
public static final dev.cel.expr.Type ANY
-
TIMESTAMP
public static final dev.cel.expr.Type TIMESTAMP
-
DURATION
public static final dev.cel.expr.Type DURATION
-
WELL_KNOWN_TYPE_MAP
public static final com.google.common.collect.ImmutableMap<java.lang.String,dev.cel.expr.Type> WELL_KNOWN_TYPE_MAP
Map of well-known proto messages and their CELTypeequivalents.
-
PRIMITIVE_TYPE_MAP
public static final com.google.common.collect.ImmutableMap<com.google.protobuf.DescriptorProtos.FieldDescriptorProto.Type,dev.cel.expr.Type> PRIMITIVE_TYPE_MAP
Map of primitive proto types and their CELTypeequivalents.
-
-
Method Detail
-
create
public static dev.cel.expr.Type create(dev.cel.expr.Type.PrimitiveType type)
Create a primitiveType.
-
create
public static dev.cel.expr.Type create(dev.cel.expr.Type.WellKnownType type)
Create a well-knownType.
-
create
public static dev.cel.expr.Type create(dev.cel.expr.Type target)
Create a typeType.
-
createList
public static dev.cel.expr.Type createList(dev.cel.expr.Type elemType)
Create a list withelemType.
-
createMap
public static dev.cel.expr.Type createMap(dev.cel.expr.Type keyType, dev.cel.expr.Type valueType)Create a map withkeyTypeandvalueType.
-
createMessage
public static dev.cel.expr.Type createMessage(java.lang.String messageName)
Create a messageTypeformessageName.
-
createTypeParam
public static dev.cel.expr.Type createTypeParam(java.lang.String name)
Create a type paramType.
-
createWrapper
public static dev.cel.expr.Type createWrapper(dev.cel.expr.Type.PrimitiveType primitive)
Create a wrapper type for theprimitive.
-
createWrapper
public static dev.cel.expr.Type createWrapper(dev.cel.expr.Type type)
Create a wrapper type where the input is aTypeof primitive types.
-
isDynOrError
@Deprecated public static boolean isDynOrError(dev.cel.expr.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(dev.cel.common.types.CelType type)
Tests whether the type has error or dyn kind. Both have the property to match any type.
-
isDyn
public static boolean isDyn(dev.cel.common.types.CelType type)
-
mostGeneral
public static dev.cel.common.types.CelType mostGeneral(dev.cel.common.types.CelType type1, dev.cel.common.types.CelType type2)Returns the more general of two types which are known to unify.
-
isAssignable
public static @Nullable java.util.Map<dev.cel.common.types.CelType,dev.cel.common.types.CelType> isAssignable(java.util.Map<dev.cel.common.types.CelType,dev.cel.common.types.CelType> subs, dev.cel.common.types.CelType type1, dev.cel.common.types.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<dev.cel.expr.Type,dev.cel.expr.Type> isAssignable(java.util.Map<dev.cel.expr.Type,dev.cel.expr.Type> subs, dev.cel.expr.Type type1, dev.cel.expr.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<dev.cel.common.types.CelType,dev.cel.common.types.CelType> isAssignable(java.util.Map<dev.cel.common.types.CelType,dev.cel.common.types.CelType> subs, java.util.List<dev.cel.common.types.CelType> list1, java.util.List<dev.cel.common.types.CelType> list2)Same asisAssignable(Map, Type, Type)but performs pairwise check on lists of types.
-
isEqualOrLessSpecific
@Deprecated public static boolean isEqualOrLessSpecific(dev.cel.expr.Type type1, dev.cel.expr.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(dev.cel.common.types.CelType type1, dev.cel.common.types.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 dev.cel.expr.Type substitute(java.util.Map<dev.cel.expr.Type,dev.cel.expr.Type> subs, dev.cel.expr.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.
-
substitute
public static dev.cel.common.types.CelType substitute(java.util.Map<dev.cel.common.types.CelType,dev.cel.common.types.CelType> subs, dev.cel.common.types.CelType type, boolean typeParamToDyn)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.
-
-