Class SpreadsheetColumn
java.lang.Object
org.eclipse.epsilon.emc.spreadsheets.SpreadsheetColumn
- Direct Known Subclasses:
ExcelColumn
This class represents a column of a worksheet. Each column must belong to a
worksheet and have a known, valid index. A valid index is greater than
returned by
SpreadsheetWorksheet#getColumnStartingIndex()
.- Author:
- Martins Francis
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetAlias()
int
getIndex()
getName()
This method returns the index of this column prefixed by SpreadsheetConstants.PREFIX_COLUMN.boolean
isIdentifiableBy
(String identifier) Column can be identified either by its name, alias or prefixed column indexboolean
isMany()
boolean
boolean
isValidIndex
(String identifier) This method checks if the index embedded within the provided prefixed column index is equal to the index of this column i.e.void
void
setDataType
(SpreadsheetDataType dataType) void
setDelimiter
(String delimiter) void
setMany
(boolean many) void
toString()
protected void
validateConstructorArguments
(SpreadsheetWorksheet worksheet, int index) This method ensures 1) given worksheet is not null 2) index is less than value returned bySpreadsheetWorksheet#getColumnStartingIndex()
- otherwise an IllegalArgumentException is thrown.
-
Field Details
-
worksheet
-
index
protected int index -
name
-
alias
-
dataType
-
many
protected boolean many -
delimiter
-
-
Constructor Details
-
SpreadsheetColumn
-
-
Method Details
-
validateConstructorArguments
This method ensures 1) given worksheet is not null 2) index is less than value returned bySpreadsheetWorksheet#getColumnStartingIndex()
- otherwise an IllegalArgumentException is thrown.- Parameters:
worksheet
-index
-
-
getWorksheet
- Returns:
- the worksheet this column belongs to
-
getIndex
public int getIndex()- Returns:
- the index of the column
-
getName
- Returns:
- the name of the column
-
getAlias
- Returns:
- the alias of the column
-
getDataType
- Returns:
- the data type of the column
-
isMany
public boolean isMany()- Returns:
- the multiplicity of the column i.e. whether it may contain multiple delimiter-separated values
-
isNotMany
public boolean isNotMany()- Returns:
- true if this column may not store multiple values in a single cell
-
getDelimiter
- Returns:
- the delimiter used for separating the individual cell values. This is useful if a column may contain multiple values
-
setName
- Parameters:
name
- the name of the column
-
setAlias
- Parameters:
alias
- the alias of the column
-
setDataType
- Parameters:
dataType
- the data type of the column
-
setMany
public void setMany(boolean many) - Parameters:
many
- the multiplicity of the column
-
setDelimiter
- Parameters:
delimiter
- the delimiter used for separating the values stored in individual cells of the column
-
isIdentifiableBy
Column can be identified either by its name, alias or prefixed column index- Parameters:
identifier
-- Returns:
- true if column can be identified by the identifier, false otherwise
-
getPrefixedIndex
This method returns the index of this column prefixed by SpreadsheetConstants.PREFIX_COLUMN.- Returns:
- prefixed index
-
isValidIndex
This method checks if the index embedded within the provided prefixed column index is equal to the index of this column i.e. it will always return true if identifier is equal to the output of getPrefixedIndex().- Parameters:
identifier
-- Returns:
- true if index of the column equals the embedded index
-
getIdentifier
- Returns:
- an identifier of the column. If name is set then it is returned, otherwise if alias is set then it is returned. If neither is set then prefixed column index is returned
-
toString
-