Class Poiji


  • public final class Poiji
    extends java.lang.Object
    The entry point of the mapping process.

    Example:

     List employees = Poiji.fromExcel(new File("employees.xls"), Employee.class);
     employees.size();
     // 3
     Employee firstEmployee = employees.get(0);
     // Employee{employeeId=123923, name='Joe', surname='Doe', age=30,
     // single=true, birthday='4/9/1987'}
     

    Created by hakan on 16/01/2017.

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> java.util.List<T> fromExcel​(java.io.File file, java.lang.Class<T> type)
      converts excel rows into a list of objects
      static <T> java.util.List<T> fromExcel​(java.io.File file, java.lang.Class<T> type, PoijiOptions options)
      converts excel rows into a list of objects
      static <T> void fromExcel​(java.io.File file, java.lang.Class<T> type, PoijiOptions options, java.util.function.Consumer<? super T> consumer)
      converts excel rows into a list of objects
      static <T> void fromExcel​(java.io.File file, java.lang.Class<T> type, java.util.function.Consumer<? super T> consumer)
      converts excel rows into a list of objects
      static <T> java.util.List<T> fromExcel​(java.io.InputStream inputStream, PoijiExcelType excelType, java.lang.Class<T> type)
      converts excel rows into a list of objects
      static <T> java.util.List<T> fromExcel​(java.io.InputStream inputStream, PoijiExcelType excelType, java.lang.Class<T> type, PoijiOptions options)
      converts excel rows into a list of objects
      static <T> void fromExcel​(java.io.InputStream inputStream, PoijiExcelType excelType, java.lang.Class<T> type, PoijiOptions options, java.util.function.Consumer<? super T> consumer)
      converts excel rows into a list of objects
      static <T> void fromExcel​(java.io.InputStream inputStream, PoijiExcelType excelType, java.lang.Class<T> type, java.util.function.Consumer<? super T> consumer)
      converts excel rows into a list of objects
      static <T> java.util.List<T> fromExcel​(org.apache.poi.ss.usermodel.Sheet sheet, java.lang.Class<T> type)
      converts excel rows into a list of objects
      static <T> java.util.List<T> fromExcel​(org.apache.poi.ss.usermodel.Sheet sheet, java.lang.Class<T> type, PoijiOptions options)
      converts excel rows into a list of objects
      static <T> void fromExcel​(org.apache.poi.ss.usermodel.Sheet sheet, java.lang.Class<T> type, PoijiOptions options, java.util.function.Consumer<? super T> consumer)
      converts excel rows into a list of objects
      static <T> T fromExcelProperties​(java.io.File file, java.lang.Class<T> type)
      converts excel properties into an object
      static <T> T fromExcelProperties​(java.io.File file, java.lang.Class<T> type, PoijiOptions options)
      converts excel properties into an object
      static <T> T fromExcelProperties​(java.io.InputStream inputStream, PoijiExcelType excelType, java.lang.Class<T> type)
      converts excel properties into an object
      static <T> T fromExcelProperties​(java.io.InputStream inputStream, PoijiExcelType excelType, java.lang.Class<T> type, PoijiOptions options)
      converts excel properties into an object
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • fromExcelProperties

        public static <T> T fromExcelProperties​(java.io.File file,
                                                java.lang.Class<T> type)
        converts excel properties into an object
        Type Parameters:
        T - type of the root object.
        Parameters:
        file - excel file ending with .xlsx.
        type - type of the root object.
        Returns:
        the newly created objects
        Throws:
        PoijiException - if an internal exception occurs during the mapping process.
        InvalidExcelFileExtension - if the specified excel file extension is invalid.
        IllegalCastException - if this Field object is enforcing Java language access control and the underlying field is either inaccessible or final.
        See Also:
        fromExcelProperties(File, Class, PoijiOptions)
      • fromExcelProperties

        public static <T> T fromExcelProperties​(java.io.InputStream inputStream,
                                                PoijiExcelType excelType,
                                                java.lang.Class<T> type)
        converts excel properties into an object
        Type Parameters:
        T - type of the root object.
        Parameters:
        inputStream - excel file stream
        excelType - type of the excel file, xlsx only!
        type - type of the root object.
        Returns:
        the newly created object
        Throws:
        PoijiException - if an internal exception occurs during the mapping process.
        InvalidExcelFileExtension - if the specified excel file extension is invalid.
        IllegalCastException - if this Field object is enforcing Java language access control and the underlying field is either inaccessible or final.
        See Also:
        fromExcelProperties(InputStream, PoijiExcelType, Class, PoijiOptions)
      • fromExcelProperties

        public static <T> T fromExcelProperties​(java.io.File file,
                                                java.lang.Class<T> type,
                                                PoijiOptions options)
        converts excel properties into an object
        Type Parameters:
        T - type of the root object.
        Parameters:
        file - excel file ending with .xlsx.
        type - type of the root object.
        options - specifies to change the default behaviour of the poiji. In this case, only the password has an effect
        Returns:
        the newly created object
        Throws:
        PoijiException - if an internal exception occurs during the mapping process.
        InvalidExcelFileExtension - if the specified excel file extension is invalid.
        IllegalCastException - if this Field object is enforcing Java language access control and the underlying field is either inaccessible or final.
        See Also:
        fromExcelProperties(File, Class)
      • fromExcelProperties

        public static <T> T fromExcelProperties​(java.io.InputStream inputStream,
                                                PoijiExcelType excelType,
                                                java.lang.Class<T> type,
                                                PoijiOptions options)
        converts excel properties into an object
        Type Parameters:
        T - type of the root object.
        Parameters:
        inputStream - excel file stream
        excelType - type of the excel file, xlsx only!
        type - type of the root object.
        options - specifies to change the default behaviour of the poiji. In this case, only the password has an effect
        Returns:
        the newly created object
        Throws:
        PoijiException - if an internal exception occurs during the mapping process.
        InvalidExcelFileExtension - if the specified excel file extension is invalid.
        IllegalCastException - if this Field object is enforcing Java language access control and the underlying field is either inaccessible or final.
        See Also:
        fromExcelProperties(InputStream, PoijiExcelType, Class)
      • fromExcel

        public static <T> java.util.List<T> fromExcel​(java.io.File file,
                                                      java.lang.Class<T> type)
        converts excel rows into a list of objects
        Type Parameters:
        T - type of the root object.
        Parameters:
        file - excel file ending with .xls or .xlsx.
        type - type of the root object.
        Returns:
        the newly created list of objects
        Throws:
        PoijiException - if an internal exception occurs during the mapping process.
        InvalidExcelFileExtension - if the specified excel file extension is invalid.
        IllegalCastException - if this Field object is enforcing Java language access control and the underlying field is either inaccessible or final.
        See Also:
        fromExcel(File, Class, PoijiOptions)
      • fromExcel

        public static <T> void fromExcel​(java.io.File file,
                                         java.lang.Class<T> type,
                                         java.util.function.Consumer<? super T> consumer)
        converts excel rows into a list of objects
        Type Parameters:
        T - type of the root object.
        Parameters:
        file - excel file ending with .xls or .xlsx.
        type - type of the root object.
        consumer - output retrieves records
        Throws:
        PoijiException - if an internal exception occurs during the mapping process.
        InvalidExcelFileExtension - if the specified excel file extension is invalid.
        IllegalCastException - if this Field object is enforcing Java language access control and the underlying field is either inaccessible or final.
        See Also:
        fromExcel(File, Class, PoijiOptions)
      • fromExcel

        public static <T> java.util.List<T> fromExcel​(java.io.InputStream inputStream,
                                                      PoijiExcelType excelType,
                                                      java.lang.Class<T> type)
        converts excel rows into a list of objects
        Type Parameters:
        T - type of the root object.
        Parameters:
        inputStream - excel file stream
        excelType - type of the excel file, xls or xlsx
        type - type of the root object.
        Returns:
        the newly created list of objects
        Throws:
        PoijiException - if an internal exception occurs during the mapping process.
        InvalidExcelFileExtension - if the specified excel file extension is invalid.
        IllegalCastException - if this Field object is enforcing Java language access control and the underlying field is either inaccessible or final.
        See Also:
        fromExcel(InputStream, PoijiExcelType, Class, PoijiOptions)
      • fromExcel

        public static <T> void fromExcel​(java.io.InputStream inputStream,
                                         PoijiExcelType excelType,
                                         java.lang.Class<T> type,
                                         java.util.function.Consumer<? super T> consumer)
        converts excel rows into a list of objects
        Type Parameters:
        T - type of the root object.
        Parameters:
        inputStream - excel file stream
        excelType - type of the excel file, xls or xlsx
        type - type of the root object.
        consumer - represents an operation that accepts the type argument
        Throws:
        PoijiException - if an internal exception occurs during the mapping process.
        InvalidExcelFileExtension - if the specified excel file extension is invalid.
        IllegalCastException - if this Field object is enforcing Java language access control and the underlying field is either inaccessible or final.
        See Also:
        fromExcel(File, Class, PoijiOptions)
      • fromExcel

        public static <T> java.util.List<T> fromExcel​(java.io.File file,
                                                      java.lang.Class<T> type,
                                                      PoijiOptions options)
        converts excel rows into a list of objects
        Type Parameters:
        T - type of the root object.
        Parameters:
        file - excel file ending with .xls or .xlsx.
        type - type of the root object.
        options - specifies to change the default behaviour of the poiji.
        Returns:
        the newly created list of objects
        Throws:
        PoijiException - if an internal exception occurs during the mapping process.
        InvalidExcelFileExtension - if the specified excel file extension is invalid.
        IllegalCastException - if this Field object is enforcing Java language access control and the underlying field is either inaccessible or final.
        See Also:
        fromExcel(File, Class)
      • fromExcel

        public static <T> void fromExcel​(java.io.File file,
                                         java.lang.Class<T> type,
                                         PoijiOptions options,
                                         java.util.function.Consumer<? super T> consumer)
        converts excel rows into a list of objects
        Type Parameters:
        T - type of the root object.
        Parameters:
        file - excel file ending with .xls or .xlsx.
        type - type of the root object.
        options - specifies to change the default behaviour of the poiji.
        consumer - represents an operation that accepts the type argument
        Throws:
        PoijiException - if an internal exception occurs during the mapping process.
        InvalidExcelFileExtension - if the specified excel file extension is invalid.
        IllegalCastException - if this Field object is enforcing Java language access control and the underlying field is either inaccessible or final.
        See Also:
        fromExcel(File, Class)
      • fromExcel

        public static <T> java.util.List<T> fromExcel​(java.io.InputStream inputStream,
                                                      PoijiExcelType excelType,
                                                      java.lang.Class<T> type,
                                                      PoijiOptions options)
        converts excel rows into a list of objects
        Type Parameters:
        T - type of the root object.
        Parameters:
        inputStream - excel file stream
        excelType - type of the excel file, xls or xlsx
        type - type of the root object.
        options - specifies to change the default behaviour of the poiji.
        Returns:
        the newly created list of objects
        Throws:
        PoijiException - if an internal exception occurs during the mapping process.
        InvalidExcelFileExtension - if the specified excel file extension is invalid.
        IllegalCastException - if this Field object is enforcing Java language access control and the underlying field is either inaccessible or final.
        See Also:
        fromExcel(InputStream, PoijiExcelType, Class)
      • fromExcel

        public static <T> void fromExcel​(java.io.InputStream inputStream,
                                         PoijiExcelType excelType,
                                         java.lang.Class<T> type,
                                         PoijiOptions options,
                                         java.util.function.Consumer<? super T> consumer)
        converts excel rows into a list of objects
        Type Parameters:
        T - type of the root object.
        Parameters:
        inputStream - excel file stream
        excelType - type of the excel file, xls or xlsx
        type - type of the root object.
        options - specifies to change the default behaviour of the poiji.
        consumer - represents an operation that accepts the type argument
        Throws:
        PoijiException - if an internal exception occurs during the mapping process.
        InvalidExcelFileExtension - if the specified excel file extension is invalid.
        IllegalCastException - if this Field object is enforcing Java language access control and the underlying field is either inaccessible or final.
        See Also:
        fromExcel(File, Class)
      • fromExcel

        public static <T> java.util.List<T> fromExcel​(org.apache.poi.ss.usermodel.Sheet sheet,
                                                      java.lang.Class<T> type,
                                                      PoijiOptions options)
        converts excel rows into a list of objects
        Type Parameters:
        T - type of the root object.
        Parameters:
        sheet - excel sheet its workbook must be either an instance of HSSFWorkbook or XSSFWorkbook.
        type - type of the root object.
        options - specifies to change the default behaviour of the poiji.
        Returns:
        the newly created objects
        Throws:
        PoijiException - if an internal exception occurs during the mapping process.
        See Also:
        fromExcel(Sheet, Class, PoijiOptions, Consumer), fromExcel(Sheet, Class)
      • fromExcel

        public static <T> java.util.List<T> fromExcel​(org.apache.poi.ss.usermodel.Sheet sheet,
                                                      java.lang.Class<T> type)
        converts excel rows into a list of objects
        Type Parameters:
        T - type of the root object.
        Parameters:
        sheet - excel sheet its workbook must be either an instance of HSSFWorkbook or XSSFWorkbook.
        type - type of the root object.
        Returns:
        the newly created objects
        Throws:
        PoijiException - if an internal exception occurs during the mapping process.
        See Also:
        fromExcel(Sheet, Class, PoijiOptions), fromExcel(Sheet, Class, PoijiOptions, Consumer)
      • fromExcel

        public static <T> void fromExcel​(org.apache.poi.ss.usermodel.Sheet sheet,
                                         java.lang.Class<T> type,
                                         PoijiOptions options,
                                         java.util.function.Consumer<? super T> consumer)
        converts excel rows into a list of objects
        Type Parameters:
        T - type of the root object.
        Parameters:
        sheet - excel sheet its workbook must be either an instance of HSSFWorkbook or XSSFWorkbook.
        type - type of the root object.
        options - specifies to change the default behaviour of the poiji.
        consumer - represents an operation that accepts the type argument.
        Throws:
        PoijiException - if an internal exception occurs during the mapping process.
        See Also:
        fromExcel(Sheet, Class, PoijiOptions), fromExcel(Sheet, Class)