Package org.ghotibeaun.json.parser.csv
Class Column
java.lang.Object
org.ghotibeaun.json.parser.csv.Column
public class Column extends Object
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description String
getColumnName()
Get the column nameint
getPosition()
Get the column position (zero-based)JSONValueType
getType()
get the column data typeboolean
isNullable()
Gets whether column can have null values.void
setColumnName(String columnName)
Set the column namevoid
setNullable(boolean nullable)
Sets whether the column can have null values.void
setPosition(int position)
Set the column position (zero-based)void
setType(JSONValueType type)
Set the column data type
-
Constructor Details
-
Column
Create a column definition. By default, it sets `nullable` to `true`, and the `type` to `UNKNOWN`- Parameters:
columnName
- the columnNameposition
- the column position
-
Column
Create a column definition. Sets the `type` to `UNKNOWN`- Parameters:
columnName
- the column nameposition
- 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
Create a column definition- Parameters:
columnName
- the column nameposition
- the column positionnullable
- specifies whether data for this column can have null values. If set to false and a null/empty value occurs, an error will be throwntype
- the data type
-
-
Method Details
-
setColumnName
Set the column name- Parameters:
columnName
- the column name
-
getColumnName
Get the column name- Returns:
- the column name
-
setType
Set the column data type- Parameters:
type
- the data type
-
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.
-