Package com.thoughtworks.excelparser.exception

Examples of com.thoughtworks.excelparser.exception.ExcelParsingException


  }

  private <T> ExcelObject getExcelObject(Class<T> clazz) throws ExcelParsingException {
    ExcelObject excelObject = clazz.getAnnotation(ExcelObject.class);
    if (excelObject == null) {
      throw new ExcelParsingException("Invalid class configuration - ExcelObject annotation missing - "
              + clazz.getSimpleName());
    }
    return excelObject;
  }
View Full Code Here


    T object = null;
    try {
      object = clazz.newInstance();
    } catch (Exception e) {
      LOGGER.error(e);
      throw new ExcelParsingException("Exception occured while instantiating the class " + clazz.getName(), e);
    }
    return object;
  }
View Full Code Here

  private <T> void setFieldValue(Field field, T object, Object cellValue) throws ExcelParsingException {
    try {
      field.set(object, cellValue);
    } catch (IllegalArgumentException e) {
      LOGGER.error(e.getMessage(), e);
      throw new ExcelParsingException("Exception occured while setting field value ", e);
    } catch (IllegalAccessException e) {
      LOGGER.error(e.getMessage(), e);
      throw new ExcelParsingException("Exception occured while setting field value ", e);
    }
  }
View Full Code Here

    } else if (type.equals(Double.class)) {
      return (T) getDoubleCell(cell, zeroIfNull, sheetName, row, col);
    } else if (type.equals(Long.class)) {
      return (T) getLongCell(cell, zeroIfNull, sheetName, row, col);
    }
    throw new ExcelParsingException(getErrorMessage(DATA_TYPE_NOT_SUPPORTED, type.getName()));
  }
View Full Code Here

   *             invalid.
   */
  Date getDateCell(Cell cell, Object... errorMessageArgs) throws ExcelParsingException {
    try {
      if (!HSSFDateUtil.isCellDateFormatted(cell)) {
        throw new ExcelParsingException(getErrorMessage(INVALID_DATE_FORMAT, errorMessageArgs));
      }
    } catch (IllegalStateException illegalStateException) {
      throw new ExcelParsingException(getErrorMessage(INVALID_DATE_FORMAT, errorMessageArgs));
    }
    return HSSFDateUtil.getJavaDate(cell.getNumericCellValue());
  }
View Full Code Here

    case HSSFCell.CELL_TYPE_FORMULA:
      return cell.getNumericCellValue();
    case HSSFCell.CELL_TYPE_BLANK:
      return zeroIfNull ? 0d : null;
    default:
      throw new ExcelParsingException(getErrorMessage(INVALID_NUMBER_FORMAT, errorMessageArgs));
    }
  }
View Full Code Here

  private Double getNumberWithoutDecimals(Cell cell, boolean zeroIfNull, Object... errorMessageArgs)
          throws ExcelParsingException {
    Double doubleValue = getDoubleCell(cell, zeroIfNull, errorMessageArgs);
    if (doubleValue != null && doubleValue % 1 != 0) {
      throw new ExcelParsingException(getErrorMessage(INVALID_NUMBER_FORMAT, errorMessageArgs));
    }
    return doubleValue;
  }
View Full Code Here

TOP

Related Classes of com.thoughtworks.excelparser.exception.ExcelParsingException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.