Class PoijiOptions.PoijiOptionsBuilder

  • Enclosing class:
    PoijiOptions

    public static class PoijiOptions.PoijiOptionsBuilder
    extends java.lang.Object
    • 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
      • 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 the Locale used by Apache Poi and PoiJ. Default is Locale.ENGLISH. This setting is only used by Apache Poi thread and PoiJ. See LocaleUtil for more details.
        Parameters:
        locale - Locale
        Returns:
        this
      • 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
      • 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 annotation ExcelCellName. 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 annotation ExcelCellName. 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