Package dev.cel.common.types
Class StructType
- java.lang.Object
-
- dev.cel.common.types.CelType
-
- dev.cel.common.types.StructType
-
- Direct Known Subclasses:
ProtoMessageType
@CheckReturnValue @Immutable public class StructType extends CelType
Struct type indicates that the typenameis a structured object with typed properties.The definition of the struct properties occurs outside the CEL type specification.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classStructType.FieldValue object which holds a reference to the field name and type.static interfaceStructType.FieldResolverTheFieldResolveris used to lookup the type of aStructType'sfieldName.
-
Field Summary
Fields Modifier and Type Field Description protected com.google.common.collect.ImmutableSet<java.lang.String>fieldNamesprotected StructType.FieldResolverfieldResolverprotected java.lang.Stringname
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StructTypecreate(java.lang.String name, com.google.common.collect.ImmutableSet<java.lang.String> fieldNames, StructType.FieldResolver fieldResolver)com.google.common.collect.ImmutableSet<java.lang.String>fieldNames()Returns the set of declare field names and their types.com.google.common.collect.ImmutableSet<StructType.Field>fields()Returns the full set ofFielddefinitions visible within this struct.java.util.Optional<StructType.Field>findField(java.lang.String fieldName)Returns theCelTypeassociated with the struct field name.booleanisAssignableFrom(CelType other)Determine whetherthistype is assignable from theothertype value.CelKindkind()Return the typeCelKind.java.lang.Stringname()Return the type name.-
Methods inherited from class dev.cel.common.types.CelType
parameters, withFreshTypeParamVariables, withParameters
-
-
-
-
Field Detail
-
name
protected final java.lang.String name
-
fieldNames
protected final com.google.common.collect.ImmutableSet<java.lang.String> fieldNames
-
fieldResolver
protected final StructType.FieldResolver fieldResolver
-
-
Method Detail
-
name
public java.lang.String name()
Description copied from class:CelTypeReturn the type name.For struct types this should be the fully qualified name. Be wary of introducing unqualified type names as they may collide with future CEL type.
-
isAssignableFrom
public boolean isAssignableFrom(CelType other)
Description copied from class:CelTypeDetermine whetherthistype is assignable from theothertype value.Defaults to an equality test.
- Overrides:
isAssignableFromin classCelType
-
findField
public java.util.Optional<StructType.Field> findField(java.lang.String fieldName)
Returns theCelTypeassociated with the struct field name.
-
fieldNames
public com.google.common.collect.ImmutableSet<java.lang.String> fieldNames()
Returns the set of declare field names and their types.
-
fields
public com.google.common.collect.ImmutableSet<StructType.Field> fields()
Returns the full set ofFielddefinitions visible within this struct.Note, the struct may support a broader set of fields than is returned; however, the input
fieldNamesto constructor limits which fields are visible.
-
create
public static StructType create(java.lang.String name, com.google.common.collect.ImmutableSet<java.lang.String> fieldNames, StructType.FieldResolver fieldResolver)
-
-