StructField (Snowpark Java API Reference 1.21.0)

Package com.snowflake.snowpark_java.types

## Class StructField

- java.lang.Object
- - com.snowflake.snowpark_java.types.StructField

-     public class StructField
      extends java.lang.Object

  Represents the content of StructType.
  Since:
    0.9.0

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `StructField​(ColumnIdentifier columnIdentifier, DataType dataType)` | Creates a new StructField with nullable column.
    `StructField​(ColumnIdentifier columnIdentifier, DataType dataType, boolean nullable)` | Creates a new StructField.
    `StructField​(java.lang.String name, DataType dataType)` | Creates a new StructField with nullable column.
    `StructField​(java.lang.String name, DataType dataType, boolean nullable)` | Creates a new StructField.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `ColumnIdentifier` | `columnIdentifier()` | Retrieves the column identifier.
    `DataType` | `dataType()` | Retrieves the column data type.
    `boolean` | `equals​(java.lang.Object other)` | Verifies if a StructField equals to this one.
    `int` | `hashCode()` | Calculates the hash code of this StructField Object.
    `java.lang.String` | `name()` | Retrieves the column name.
    `boolean` | `nullable()` | Verifies if this column is nullable.
    `java.lang.String` | `toString()` | Generates a String value to represent this StructField.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### StructField

          public StructField​(ColumnIdentifier columnIdentifier,
                             DataType dataType,
                             boolean nullable)

      Creates a new StructField.
      Parameters:
        `columnIdentifier` - A ColumnIdentifier presenting column name
        `dataType` - The column data type
        `nullable` - Whether the column is nullable or not
      Since:
        0.9.0

    - #### StructField

          public StructField​(ColumnIdentifier columnIdentifier,
                             DataType dataType)

      Creates a new StructField with nullable column.
      Parameters:
        `columnIdentifier` - A ColumnIdentifier presenting column name
        `dataType` - The column data type
      Since:
        0.9.0

    - #### StructField

          public StructField​(java.lang.String name,
                             DataType dataType,
                             boolean nullable)

      Creates a new StructField.
      Parameters:
        `name` - The column name
        `dataType` - The column data type
        `nullable` - Whether the column is nullable or not
      Since:
        0.9.0

    - #### StructField

          public StructField​(java.lang.String name,
                             DataType dataType)

      Creates a new StructField with nullable column.
      Parameters:
        `name` - The column name
        `dataType` - The column data type
      Since:
        0.9.0

  - ### Method Detail

    - #### name

          public java.lang.String name()

      Retrieves the column name.
      Returns:
        A String value representing the column name
      Since:
        0.9.0

    - #### columnIdentifier

          public ColumnIdentifier columnIdentifier()

      Retrieves the column identifier.
      Returns:
        A ColumnIdentifier representing the column name
      Since:
        0.9.0

    - #### dataType

          public DataType dataType()

      Retrieves the column data type.
      Returns:
        A DataType object representing the column data type
      Since:
        0.9.0

    - #### nullable

          public boolean nullable()

      Verifies if this column is nullable.
      Returns:
        A boolean value representing whether this column is nullable
      Since:
        0.9.0

    - #### toString

          public java.lang.String toString()

      Generates a String value to represent this StructField.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        A String value in the format of "StructField('name', 'data type', 'nullable')"
      Since:
        0.9.0

    - #### equals

          public boolean equals​(java.lang.Object other)

      Verifies if a StructField equals to this one.
      Overrides:
        `equals` in class `java.lang.Object`
      Parameters:
        `other` - A StructField object
      Returns:
        true if these two StructFields are equivalent, false for otherwise.
      Since:
        0.9.0

    - #### hashCode

          public int hashCode()

      Calculates the hash code of this StructField Object.
      Overrides:
        `hashCode` in class `java.lang.Object`
      Returns:
        An int number representing the hash code value
      Since:
        0.9.0