Class SpreadsheetColumn
- java.lang.Object
-
- org.eclipse.epsilon.emc.spreadsheets.SpreadsheetColumn
-
- Direct Known Subclasses:
ConcreteColumn
,ExcelColumn
,GSColumn
public abstract class SpreadsheetColumn extends Object
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 bySpreadsheetWorksheet#getColumnStartingIndex()
.- Author:
- Martins Francis
-
-
Constructor Summary
Constructors Constructor Description SpreadsheetColumn(SpreadsheetWorksheet worksheet, int index)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getAlias()
SpreadsheetDataType
getDataType()
String
getDelimiter()
String
getIdentifier()
int
getIndex()
String
getName()
String
getPrefixedIndex()
This method returns the index of this column prefixed by SpreadsheetConstants.PREFIX_COLUMN.SpreadsheetWorksheet
getWorksheet()
boolean
isIdentifiableBy(String identifier)
Column can be identified either by its name, alias or prefixed column indexboolean
isMany()
boolean
isNotMany()
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
setAlias(String alias)
void
setDataType(SpreadsheetDataType dataType)
void
setDelimiter(String delimiter)
void
setMany(boolean many)
void
setName(String name)
String
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 Detail
-
worksheet
protected SpreadsheetWorksheet worksheet
-
index
protected int index
-
name
protected String name
-
alias
protected String alias
-
dataType
protected SpreadsheetDataType dataType
-
many
protected boolean many
-
delimiter
protected String delimiter
-
-
Constructor Detail
-
SpreadsheetColumn
public SpreadsheetColumn(SpreadsheetWorksheet worksheet, int index)
-
-
Method Detail
-
validateConstructorArguments
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.- Parameters:
worksheet
-index
-
-
getWorksheet
public SpreadsheetWorksheet getWorksheet()
- Returns:
- the worksheet this column belongs to
-
getIndex
public int getIndex()
- Returns:
- the index of the column
-
getName
public String getName()
- Returns:
- the name of the column
-
getAlias
public String getAlias()
- Returns:
- the alias of the column
-
getDataType
public SpreadsheetDataType 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
public String getDelimiter()
- Returns:
- the delimiter used for separating the individual cell values. This is useful if a column may contain multiple values
-
setName
public void setName(String name)
- Parameters:
name
- the name of the column
-
setAlias
public void setAlias(String alias)
- Parameters:
alias
- the alias of the column
-
setDataType
public void setDataType(SpreadsheetDataType dataType)
- Parameters:
dataType
- the data type of the column
-
setMany
public void setMany(boolean many)
- Parameters:
many
- the multiplicity of the column
-
setDelimiter
public void setDelimiter(String delimiter)
- Parameters:
delimiter
- the delimiter used for separating the values stored in individual cells of the column
-
isIdentifiableBy
public boolean isIdentifiableBy(String identifier)
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
public String getPrefixedIndex()
This method returns the index of this column prefixed by SpreadsheetConstants.PREFIX_COLUMN.- Returns:
- prefixed index
-
isValidIndex
public 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. 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
public String 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
-
-