Class StructType

  • Direct Known Subclasses:
    ProtoMessageType

    @CheckReturnValue
    @Immutable
    public class StructType
    extends CelType
    Struct type indicates that the type name is a structured object with typed properties.

    The definition of the struct properties occurs outside the CEL type specification.

    • Field Detail

      • name

        protected final java.lang.String name
      • fieldNames

        protected final com.google.common.collect.ImmutableSet<java.lang.String> fieldNames
    • Method Detail

      • kind

        public CelKind kind()
        Description copied from class: CelType
        Return the type CelKind.
        Specified by:
        kind in class CelType
      • name

        public java.lang.String name()
        Description copied from class: CelType
        Return 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.

        Specified by:
        name in class CelType
      • isAssignableFrom

        public boolean isAssignableFrom​(CelType other)
        Description copied from class: CelType
        Determine whether this type is assignable from the other type value.

        Defaults to an equality test.

        Overrides:
        isAssignableFrom in class CelType
      • findField

        public java.util.Optional<StructType.Field> findField​(java.lang.String fieldName)
        Returns the CelType associated 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 of Field definitions visible within this struct.

        Note, the struct may support a broader set of fields than is returned; however, the input fieldNames to 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)