Class StructField


  • public class StructField
    extends Object
    Represents the content of StructType.
    Since:
    0.9.0
    • 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​(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​(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 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 String toString()
        Generates a String value to represent this StructField.
        Overrides:
        toString in class Object
        Returns:
        A String value in the format of "StructField('name', 'data type', 'nullable')"
        Since:
        0.9.0
      • equals

        public boolean equals​(Object other)
        Verifies if a StructField equals to this one.
        Overrides:
        equals in class 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 Object
        Returns:
        An int number representing the hash code value
        Since:
        0.9.0