Package com.poiji.option
Class PoijiOptions.PoijiOptionsBuilder
- java.lang.Object
-
- com.poiji.option.PoijiOptions.PoijiOptionsBuilder
-
- Enclosing class:
- PoijiOptions
public static class PoijiOptions.PoijiOptionsBuilder extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PoijiOptions.PoijiOptionsBuilder
addListDelimiter(java.lang.String delimiter)
Use different delimiter to split the list of items of a cellPoijiOptions
build()
PoijiOptions.PoijiOptionsBuilder
caseInsensitive(boolean caseInsensitive)
Permits case insensitive column names mapping for annotationExcelCellName
.PoijiOptions.PoijiOptionsBuilder
dateFormatter(java.time.format.DateTimeFormatter dateFormatter)
set a date formatter, default date time formatter is "dd/M/yyyy" for java.time.LocalDatePoijiOptions.PoijiOptionsBuilder
dateLenient(boolean dateLenient)
If the simple date format is lenient, use to set how strict the date formatting must be, defaults to lenient false.PoijiOptions.PoijiOptionsBuilder
datePattern(java.lang.String datePattern)
set date pattern, default date format is "dd/M/yyyy" for java.util.DatePoijiOptions.PoijiOptionsBuilder
dateRegex(java.lang.String dateRegex)
Date regex, if would like to specify a regex patter the date must be in, e.g.\\d{2}/\\d{1}/\\d{4}.PoijiOptions.PoijiOptionsBuilder
dateTimeFormatter(java.time.format.DateTimeFormatter dateTimeFormatter)
set a date time formatter, default date time formatter is "dd/M/yyyy HH:mm:ss" for java.time.LocalDateTimePoijiOptions.PoijiOptionsBuilder
dateTimeRegex(java.lang.String dateTimeRegex)
DateTime regex, if would like to specify a regex patter the date time must be in, e.g.\\d{2}/\\d{1}/\\d{4} \\d{2}:\\d{2}:\\d{2}.PoijiOptions.PoijiOptionsBuilder
disableXLSXNumberCellFormat()
Disable the cell format of all the number cells of an excel file ending with xlsxPoijiOptions.PoijiOptionsBuilder
headerCount(int headerCount)
This is to set the number of row contains headers Set 0 to indicate that no header in the excel file.PoijiOptions.PoijiOptionsBuilder
headerStart(int headerStart)
This is to set the row which the unmarshall will use to start reading header titles, incase the header is not in row 0.PoijiOptions.PoijiOptionsBuilder
ignoreHiddenSheets(boolean ignoreHiddenSheets)
Ignore hidden sheetsPoijiOptions.PoijiOptionsBuilder
ignoreWhitespaces(boolean ignoreWhitespaces)
Ignore white space before and after column names for annotationExcelCellName
.PoijiOptions.PoijiOptionsBuilder
limit(int limit)
limit a number of rows after the header & skipped rows row.PoijiOptions.PoijiOptionsBuilder
password(java.lang.String password)
set password for encrypted excel file, Default is nullPoijiOptions.PoijiOptionsBuilder
poijiLogCellFormat(PoijiLogCellFormat cellFormat)
Add cell format option to see each internal cell's excel format for files ending with xlsx format.PoijiOptions.PoijiOptionsBuilder
poijiNumberFormat(PoijiNumberFormat numberFormat)
Change the default cell formats of a xlsx excel file by overridingPoijiOptions.PoijiOptionsBuilder
preferNullOverDefault(boolean preferNullOverDefault)
set whether or not to use null instead of default values for Integer, Double, Float, Long, String and java.util.Date types.PoijiOptions.PoijiOptionsBuilder
rawData(boolean status)
Use this option to get the underlying/original/non-visible/raw cell value.PoijiOptions.PoijiOptionsBuilder
setLocale(java.util.Locale locale)
Set theLocale
used by Apache Poi and PoiJ.static PoijiOptions.PoijiOptionsBuilder
settings()
static PoijiOptions.PoijiOptionsBuilder
settings(int skip)
Skip a number of rows after the header row.PoijiOptions.PoijiOptionsBuilder
sheetIndex(int sheetIndex)
set sheet index, default is 0PoijiOptions.PoijiOptionsBuilder
sheetName(java.lang.String sheetName)
Set the sheet NamePoijiOptions.PoijiOptionsBuilder
skip(int skip)
skip a number of rows after the header row.PoijiOptions.PoijiOptionsBuilder
trimCellValue(boolean trimCellValue)
Trim cell valuePoijiOptions.PoijiOptionsBuilder
withCasting(Casting casting)
Use a custom casting implementationPoijiOptions.PoijiOptionsBuilder
withFormatting(Formatting formatting)
Use a custom excel header format implementation
-
-
-
Method Detail
-
settings
public static PoijiOptions.PoijiOptionsBuilder settings(int skip)
Skip a number of rows after the header row. The header row is not counted.- Parameters:
skip
- ignored row number after the header row- Returns:
- builder itself
-
settings
public static PoijiOptions.PoijiOptionsBuilder settings()
-
dateFormatter
public PoijiOptions.PoijiOptionsBuilder dateFormatter(java.time.format.DateTimeFormatter dateFormatter)
set a date formatter, default date time formatter is "dd/M/yyyy" for java.time.LocalDate- Parameters:
dateFormatter
- date time formatter- Returns:
- this
-
dateTimeFormatter
public PoijiOptions.PoijiOptionsBuilder dateTimeFormatter(java.time.format.DateTimeFormatter dateTimeFormatter)
set a date time formatter, default date time formatter is "dd/M/yyyy HH:mm:ss" for java.time.LocalDateTime- Parameters:
dateTimeFormatter
- date time formatter- Returns:
- this
-
datePattern
public PoijiOptions.PoijiOptionsBuilder datePattern(java.lang.String datePattern)
set date pattern, default date format is "dd/M/yyyy" for java.util.Date- Parameters:
datePattern
- date time formatter- Returns:
- this
-
preferNullOverDefault
public PoijiOptions.PoijiOptionsBuilder preferNullOverDefault(boolean preferNullOverDefault)
set whether or not to use null instead of default values for Integer, Double, Float, Long, String and java.util.Date types.- Parameters:
preferNullOverDefault
- boolean- Returns:
- this
-
setLocale
public PoijiOptions.PoijiOptionsBuilder setLocale(java.util.Locale locale)
Set theLocale
used by Apache Poi and PoiJ. Default isLocale.ENGLISH
. This setting is only used by Apache Poi thread and PoiJ. SeeLocaleUtil
for more details.- Parameters:
locale
- Locale- Returns:
- this
-
build
public PoijiOptions build()
-
sheetIndex
public PoijiOptions.PoijiOptionsBuilder sheetIndex(int sheetIndex)
set sheet index, default is 0- Parameters:
sheetIndex
- number- Returns:
- this
-
sheetName
public PoijiOptions.PoijiOptionsBuilder sheetName(java.lang.String sheetName)
Set the sheet Name- Parameters:
sheetName
- excel sheet name- Returns:
- this
-
skip
public PoijiOptions.PoijiOptionsBuilder skip(int skip)
skip a number of rows after the header row. The header row is not counted.- Parameters:
skip
- number- Returns:
- this
-
limit
public PoijiOptions.PoijiOptionsBuilder limit(int limit)
limit a number of rows after the header & skipped rows row. The header & skipped rows are not counted.- Parameters:
limit
- number- Returns:
- this
-
password
public PoijiOptions.PoijiOptionsBuilder password(java.lang.String password)
set password for encrypted excel file, Default is null- Parameters:
password
- excel password- Returns:
- this
-
ignoreHiddenSheets
public PoijiOptions.PoijiOptionsBuilder ignoreHiddenSheets(boolean ignoreHiddenSheets)
Ignore hidden sheets- Parameters:
ignoreHiddenSheets
- whether or not to ignore any hidden sheets in the work book.- Returns:
- this
-
trimCellValue
public PoijiOptions.PoijiOptionsBuilder trimCellValue(boolean trimCellValue)
Trim cell value- Parameters:
trimCellValue
- trim the cell value before processing work book.- Returns:
- this
-
dateRegex
public PoijiOptions.PoijiOptionsBuilder dateRegex(java.lang.String dateRegex)
Date regex, if would like to specify a regex patter the date must be in, e.g.\\d{2}/\\d{1}/\\d{4}.- Parameters:
dateRegex
- date regex pattern- Returns:
- this
-
dateTimeRegex
public PoijiOptions.PoijiOptionsBuilder dateTimeRegex(java.lang.String dateTimeRegex)
DateTime regex, if would like to specify a regex patter the date time must be in, e.g.\\d{2}/\\d{1}/\\d{4} \\d{2}:\\d{2}:\\d{2}.- Parameters:
dateTimeRegex
- date regex pattern- Returns:
- this
-
dateLenient
public PoijiOptions.PoijiOptionsBuilder dateLenient(boolean dateLenient)
If the simple date format is lenient, use to set how strict the date formatting must be, defaults to lenient false. It works only for java.util.Date.- Parameters:
dateLenient
- true or false- Returns:
- this
-
withCasting
public PoijiOptions.PoijiOptionsBuilder withCasting(Casting casting)
Use a custom casting implementation- Parameters:
casting
- custom casting implementation- Returns:
- this
-
headerStart
public PoijiOptions.PoijiOptionsBuilder headerStart(int headerStart)
This is to set the row which the unmarshall will use to start reading header titles, incase the header is not in row 0.- Parameters:
headerStart
- an index number of the excel header to start reading header- Returns:
- this
-
headerCount
public PoijiOptions.PoijiOptionsBuilder headerCount(int headerCount)
This is to set the number of row contains headers Set 0 to indicate that no header in the excel file. Default - 1.- Parameters:
headerCount
- an index number of the excel header to start reading header- Returns:
- this
-
caseInsensitive
public PoijiOptions.PoijiOptionsBuilder caseInsensitive(boolean caseInsensitive)
Permits case insensitive column names mapping for annotationExcelCellName
. Default - false.- Parameters:
caseInsensitive
- true or false- Returns:
- this
-
ignoreWhitespaces
public PoijiOptions.PoijiOptionsBuilder ignoreWhitespaces(boolean ignoreWhitespaces)
Ignore white space before and after column names for annotationExcelCellName
. Default - false.- Parameters:
ignoreWhitespaces
- true or false- Returns:
- this
-
poijiLogCellFormat
public PoijiOptions.PoijiOptionsBuilder poijiLogCellFormat(PoijiLogCellFormat cellFormat)
Add cell format option to see each internal cell's excel format for files ending with xlsx format. This option should be enabled for debugging purpose.- Parameters:
cellFormat
- poiji cell format instance- Returns:
- this
-
poijiNumberFormat
public PoijiOptions.PoijiOptionsBuilder poijiNumberFormat(PoijiNumberFormat numberFormat)
Change the default cell formats of a xlsx excel file by overriding- Parameters:
numberFormat
- poiji number format instance- Returns:
- this
-
disableXLSXNumberCellFormat
public PoijiOptions.PoijiOptionsBuilder disableXLSXNumberCellFormat()
Disable the cell format of all the number cells of an excel file ending with xlsx- Returns:
- this
-
addListDelimiter
public PoijiOptions.PoijiOptionsBuilder addListDelimiter(java.lang.String delimiter)
Use different delimiter to split the list of items of a cell- Parameters:
delimiter
- by default delimiter is ','- Returns:
- this
-
withFormatting
public PoijiOptions.PoijiOptionsBuilder withFormatting(Formatting formatting)
Use a custom excel header format implementation- Parameters:
formatting
- custom header format implementation- Returns:
- this
-
rawData
public PoijiOptions.PoijiOptionsBuilder rawData(boolean status)
Use this option to get the underlying/original/non-visible/raw cell value. The cell must be a numeric type.- Parameters:
status
- set true to retrieve the underlying data in the excel file.- Returns:
- this
-
-