Class Column

java.lang.Object
org.ghotibeaun.json.parser.csv.Column

public class Column
extends Object
  • Constructor Details

    • Column

      public Column​(String columnName, int position)
      Create a column definition. By default, it sets `nullable` to `true`, and the `type` to `UNKNOWN`
      Parameters:
      columnName - the columnName
      position - the column position
    • Column

      public Column​(String columnName, int position, boolean nullable)
      Create a column definition. Sets the `type` to `UNKNOWN`
      Parameters:
      columnName - the column name
      position - the column position (zero-based)
      nullable - specifies whether the data for this column can have null values - if set to false and a null/empty value occurs an error will be thrown
    • Column

      public Column​(String columnName, int position, boolean nullable, JSONValueType type)
      Create a column definition
      Parameters:
      columnName - the column name
      position - the column position
      nullable - specifies whether data for this column can have null values. If set to false and a null/empty value occurs, an error will be thrown
      type - the data type
  • Method Details

    • setColumnName

      public void setColumnName​(String columnName)
      Set the column name
      Parameters:
      columnName - the column name
    • getColumnName

      public String getColumnName()
      Get the column name
      Returns:
      the column name
    • setType

      public void setType​(JSONValueType type)
      Set the column data type
      Parameters:
      type - the data type
    • getType

      public JSONValueType getType()
      get the column data type
      Returns:
      the column data type
    • setPosition

      public void setPosition​(int position)
      Set the column position (zero-based)
      Parameters:
      position - the column position
    • getPosition

      public int getPosition()
      Get the column position (zero-based)
      Returns:
      the column position
    • setNullable

      public void setNullable​(boolean nullable)
      Sets whether the column can have null values. This is useful for data and number fields, but can be used for String fields as well.
      Parameters:
      nullable - sets whether column can have null values
    • isNullable

      public boolean isNullable()
      Gets whether column can have null values.
      Returns:
      true if the field can have null values; false otherwise. For Strings, if the value is false, the expectation is to create an empty String value. For numbers, if the value is false, then it is expected to return 0. For dates, if the date is false, an error will occur.