Class Poiji

java.lang.Object
com.poiji.bind.Poiji

public final class Poiji extends 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 Details

    • fromExcelProperties

      public static <T> T fromExcelProperties(File file, 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

      public static <T> T fromExcelProperties(InputStream inputStream, PoijiExcelType excelType, 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

      public static <T> T fromExcelProperties(File file, 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

      public static <T> T fromExcelProperties(InputStream inputStream, PoijiExcelType excelType, 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:
    • fromExcel

      public static <T> List<T> fromExcel(File file, 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

      public static <T> void fromExcel(File file, Class<T> type, 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

      public static <T> List<T> fromExcel(InputStream inputStream, PoijiExcelType excelType, 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

      public static <T> void fromExcel(InputStream inputStream, PoijiExcelType excelType, Class<T> type, 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

      public static <T> List<T> fromExcel(File file, 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

      public static <T> void fromExcel(File file, Class<T> type, PoijiOptions options, 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

      public static <T> List<T> fromExcel(InputStream inputStream, PoijiExcelType excelType, 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

      public static <T> void fromExcel(InputStream inputStream, PoijiExcelType excelType, Class<T> type, PoijiOptions options, 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

      public static <T> List<T> fromExcel(org.apache.poi.ss.usermodel.Sheet sheet, 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

      public static <T> List<T> fromExcel(org.apache.poi.ss.usermodel.Sheet sheet, 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

      public static <T> void fromExcel(org.apache.poi.ss.usermodel.Sheet sheet, Class<T> type, PoijiOptions options, 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: