Package com.d3x.morpheus.excel
Class ExcelSource.Options
- java.lang.Object
-
- com.d3x.morpheus.excel.ExcelSource.Options
-
- Enclosing class:
- ExcelSource
public static class ExcelSource.Options extends java.lang.ObjectThe options for this source
-
-
Field Summary
Fields Modifier and Type Field Description private ExcelSource.CoordinatebottomRightThe optional top right coordinate (zero-based) that defines bottom right corner cell for table to parseprivate booleanheaderTrue indicates that the first row serves as a header for frameprivate com.d3x.morpheus.util.ResourceresourceThe resource to load fromprivate java.util.function.Predicate<org.apache.poi.ss.usermodel.Row>rowPredicateThe optional row predicate to includes rowsprivate java.lang.StringsheetNameThe optional worksheet name, otherwise the first sheet is extractedprivate ExcelSource.CoordinatetopLeftThe optional top right coordinate (zero-based) that defines top left corner cell for table to parse
-
Constructor Summary
Constructors Constructor Description Options()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExcelSource.CoordinategetBottomRight()private intgetDataEndRowIndex(org.apache.poi.ss.usermodel.Sheet sheet)Returns the row index of the last row containing dataprivate intgetDataStartRowIndex()Returns the row index of the first row containing datacom.d3x.morpheus.util.ResourcegetResource()java.util.function.Predicate<org.apache.poi.ss.usermodel.Row>getRowPredicate()private org.apache.poi.ss.usermodel.SheetgetSheet(org.apache.poi.ss.usermodel.Workbook workbook)Returns the worksheet to parsejava.lang.StringgetSheetName()ExcelSource.CoordinategetTopLeft()booleanisHeader()voidsetBottomRight(ExcelSource.Coordinate bottomRight)voidsetFile(java.io.File file)Sets the file to load fromvoidsetHeader(boolean header)voidsetInputStream(java.io.InputStream stream)Sets the input stream to load fromvoidsetResource(java.lang.String resource)Sets the resource string to load fromvoidsetRowPredicate(java.util.function.Predicate<org.apache.poi.ss.usermodel.Row> rowPredicate)voidsetSheetName(java.lang.String sheetName)voidsetTopLeft(ExcelSource.Coordinate topLeft)voidsetURL(java.net.URL url)Sets the URL to load fromvoidvalidate()Validates that these options are complete
-
-
-
Field Detail
-
resource
private com.d3x.morpheus.util.Resource resource
The resource to load from
-
header
private boolean header
True indicates that the first row serves as a header for frame
-
sheetName
private java.lang.String sheetName
The optional worksheet name, otherwise the first sheet is extracted
-
topLeft
private ExcelSource.Coordinate topLeft
The optional top right coordinate (zero-based) that defines top left corner cell for table to parse
-
bottomRight
private ExcelSource.Coordinate bottomRight
The optional top right coordinate (zero-based) that defines bottom right corner cell for table to parse
-
rowPredicate
private java.util.function.Predicate<org.apache.poi.ss.usermodel.Row> rowPredicate
The optional row predicate to includes rows
-
-
Method Detail
-
validate
public void validate()
Validates that these options are complete
-
getSheet
private org.apache.poi.ss.usermodel.Sheet getSheet(org.apache.poi.ss.usermodel.Workbook workbook)
Returns the worksheet to parse- Parameters:
workbook- the workbook reference- Returns:
- the worksheet
-
setFile
public void setFile(java.io.File file)
Sets the file to load from- Parameters:
file- the file reference
-
setURL
public void setURL(java.net.URL url)
Sets the URL to load from- Parameters:
url- the url reference
-
setInputStream
public void setInputStream(java.io.InputStream stream)
Sets the input stream to load from- Parameters:
stream- the input stream
-
setResource
public void setResource(java.lang.String resource)
Sets the resource string to load from- Parameters:
resource- the resource string
-
getDataStartRowIndex
private int getDataStartRowIndex()
Returns the row index of the first row containing data- Returns:
- the row index of first row with data
-
getDataEndRowIndex
private int getDataEndRowIndex(org.apache.poi.ss.usermodel.Sheet sheet)
Returns the row index of the last row containing data- Parameters:
sheet- the sheet reference- Returns:
- the row index of last row with data
-
getResource
public com.d3x.morpheus.util.Resource getResource()
-
isHeader
public boolean isHeader()
-
setHeader
public void setHeader(boolean header)
-
getSheetName
public java.lang.String getSheetName()
-
setSheetName
public void setSheetName(java.lang.String sheetName)
-
getTopLeft
public ExcelSource.Coordinate getTopLeft()
-
setTopLeft
public void setTopLeft(ExcelSource.Coordinate topLeft)
-
getBottomRight
public ExcelSource.Coordinate getBottomRight()
-
setBottomRight
public void setBottomRight(ExcelSource.Coordinate bottomRight)
-
getRowPredicate
public java.util.function.Predicate<org.apache.poi.ss.usermodel.Row> getRowPredicate()
-
setRowPredicate
public void setRowPredicate(java.util.function.Predicate<org.apache.poi.ss.usermodel.Row> rowPredicate)
-
-