ExcelConverterSimpleSpreadSheetCellDAO implements Serializable { public SpreadSheetCellDAO[] getSpreadSheetCellDAOfromSimpleDataType(Object[] row, String sheetName, int rowNum) { SpreadSheetCellDAO[] result = new SpreadSheetCellDAO[row.length]; for (int currentColumnNum = 0; currentColumnNum < row.length; currentColumnNum++) { Object x = row[currentColumnNum]; String formattedValue = ""; String comment = ""; String formula = ""; String address = ""; StringBuffer sb = new StringBuffer(); if (x != null) { if (x instanceof SpreadSheetCellDAO) { result[currentColumnNum] = (SpreadSheetCellDAO) x; } else { if (x instanceof Boolean) { formattedValue = ""; comment = ""; formula = String.valueOf(x); address = MSExcelUtil.getCellAddressA1Format(rowNum, currentColumnNum); } else if (x instanceof Byte) { formattedValue = ""; comment = ""; formula = String.valueOf(x); address = MSExcelUtil.getCellAddressA1Format(rowNum, currentColumnNum); } else if (x instanceof Short) { formattedValue =""; comment = ""; formula = ""; formula = String.valueOf(x); address = MSExcelUtil.getCellAddressA1Format(rowNum, currentColumnNum); } else if (x instanceof Integer) { formattedValue = ""; comment = ""; formula = String.valueOf(x); address = MSExcelUtil.getCellAddressA1Format(rowNum, currentColumnNum); } else if (x instanceof Long) { formattedValue = ""; comment = ""; formula = String.valueOf(x); address = MSExcelUtil.getCellAddressA1Format(rowNum, currentColumnNum); } else if (x instanceof Double) { formattedValue = ""; comment = ""; formula = String.valueOf(x); address = MSExcelUtil.getCellAddressA1Format(rowNum, currentColumnNum); } else if (x instanceof Float) { formattedValue = ""; comment = ""; formula = String.valueOf(x); address = MSExcelUtil.getCellAddressA1Format(rowNum, currentColumnNum); } else if (x instanceof BigDecimal) { formattedValue = ""; comment = ""; formula = ((BigDecimal) x).toString(); address = MSExcelUtil.getCellAddressA1Format(rowNum, currentColumnNum); } else if (x instanceof Timestamp) { if (this.dateTimeFormat==null) { formattedValue = String.valueOf(x); } else { formattedValue=this.dateTimeFormat.format(x,sb,new FieldPosition(0)).toString(); sb.setLength(0); } comment = ""; formula = ""; address = MSExcelUtil.getCellAddressA1Format(rowNum, currentColumnNum); } else if (x instanceof Date) { formattedValue = this.dateFormat.format((Date) x); comment = ""; formula = ""; address = MSExcelUtil.getCellAddressA1Format(rowNum, currentColumnNum); } else if (x instanceof String) { formattedValue = x.toString(); comment = ""; formula = ""; address = MSExcelUtil.getCellAddressA1Format(rowNum, currentColumnNum); } else if ((x instanceof String[]) && ((String[]) x).length == 5) { String[] spreadSheetCellDAOAsArray = (String[]) x; formattedValue = spreadSheetCellDAOAsArray[0]; comment = spreadSheetCellDAOAsArray[1]; formula = spreadSheetCellDAOAsArray[2]; address = spreadSheetCellDAOAsArray[3]; sheetName = spreadSheetCellDAOAsArray[4]; } else { LOG.warn("Unknown datatype in column number: " + currentColumnNum + ". Reported data type" + x.getClass().getName() + ". Trying to use .toString"); formattedValue = x.toString(); comment = ""; formula = ""; address = MSExcelUtil.getCellAddressA1Format(rowNum, currentColumnNum); } result[currentColumnNum] = new SpreadSheetCellDAO(formattedValue, comment, formula, address, sheetName); } } } return result; } ExcelConverterSimpleSpreadSheetCellDAO(SimpleDateFormat dateFormat, DecimalFormat decimalFormat);  ExcelConverterSimpleSpreadSheetCellDAO(SimpleDateFormat dateFormat, DecimalFormat decimalFormat,
			SimpleDateFormat dateTimeFormat); void updateSpreadSheetCellRowToInferSchemaInformation(SpreadSheetCellDAO[] dataRow); GenericDataType[] getSchemaRow(); void setSchemaRow(GenericDataType[] schemaRow); Object[] getDataAccordingToSchema(SpreadSheetCellDAO[] dataRow); SpreadSheetCellDAO[] getSpreadSheetCellDAOfromSimpleDataType(Object[] row, String sheetName, int rowNum);  }
@Test public void getSpreadSheetCellDAOfromSimpleDataType() throws ParseException { SimpleDateFormat dateFormat = (SimpleDateFormat)DateFormat.getDateInstance(DateFormat.SHORT, Locale.US); DecimalFormat decimalFormat = (DecimalFormat) DecimalFormat.getInstance(Locale.GERMAN); ExcelConverterSimpleSpreadSheetCellDAO converter = new ExcelConverterSimpleSpreadSheetCellDAO(dateFormat,decimalFormat); Object[] rowA = new Object[13]; rowA[0] = new Boolean(true); rowA[1] = new Byte((byte) 100); rowA[2] = new Short((short) 1000); rowA[3] = new Integer(32000); rowA[4] = new Long(65536L); rowA[5] = new Double(2.5); rowA[6] = new Float(3.5f); rowA[7] = new BigDecimal(1.5); rowA[8] = dateFormat.parse("1/13/2018"); rowA[9] = new java.sql.Date(dateFormat.parse("1/13/2018").getTime()); rowA[10] = new Timestamp(dateFormat.parse("1/13/2018").getTime()); rowA[11] = "This is a test"; rowA[12] = null; SpreadSheetCellDAO[] actual = converter.getSpreadSheetCellDAOfromSimpleDataType(rowA, "testsheet", 0); assertEquals("",actual[0].getFormattedValue(),"Formatted Value is empty"); assertEquals("",actual[0].getComment(),"Comment is empty"); assertEquals("true",actual[0].getFormula(),"Formula contains data type"); assertEquals("A1",actual[0].getAddress(),"Address is correct"); assertEquals("",actual[1].getFormattedValue(),"Formatted Value is empty"); assertEquals("",actual[1].getComment(),"Comment is empty"); assertEquals("100",actual[1].getFormula(),"Formula contains data type"); assertEquals("B1",actual[1].getAddress(),"Address is correct"); assertEquals("",actual[2].getFormattedValue(),"Formatted Value is empty"); assertEquals("",actual[2].getComment(),"Comment is empty"); assertEquals("1000",actual[2].getFormula(),"Formula contains data type"); assertEquals("C1",actual[2].getAddress(),"Address is correct"); assertEquals("",actual[3].getFormattedValue(),"Formatted Value is empty"); assertEquals("",actual[3].getComment(),"Comment is empty"); assertEquals("32000",actual[3].getFormula(),"Formula contains data type"); assertEquals("D1",actual[3].getAddress(),"Address is correct"); assertEquals("",actual[4].getFormattedValue(),"Formatted Value is empty"); assertEquals("",actual[4].getComment(),"Comment is empty"); assertEquals("65536",actual[4].getFormula(),"Formula contains data type"); assertEquals("E1",actual[4].getAddress(),"Address is correct"); assertEquals("",actual[5].getFormattedValue(),"Formatted Value is empty"); assertEquals("",actual[5].getComment(),"Comment is empty"); assertEquals("2.5",actual[5].getFormula(),"Formula contains data type"); assertEquals("F1",actual[5].getAddress(),"Address is correct"); assertEquals("",actual[6].getFormattedValue(),"Formatted Value is empty"); assertEquals("",actual[6].getComment(),"Comment is empty"); assertEquals("3.5",actual[6].getFormula(),"Formula contains data type"); assertEquals("G1",actual[6].getAddress(),"Address is correct"); assertEquals("",actual[7].getFormattedValue(),"Formatted Value is empty"); assertEquals("",actual[7].getComment(),"Comment is empty"); assertEquals("1.5",actual[7].getFormula(),"Formula contains data type"); assertEquals("H1",actual[7].getAddress(),"Address is correct"); assertEquals("1/13/18",actual[8].getFormattedValue(),"Formatted Value contains data type"); assertEquals("",actual[8].getComment(),"Comment is empty"); assertEquals("",actual[8].getFormula(),"Formula is empty"); assertEquals("I1",actual[8].getAddress(),"Address is correct"); assertEquals("1/13/18",actual[9].getFormattedValue(),"Formatted Value contains data type"); assertEquals("",actual[9].getComment(),"Comment is empty"); assertEquals("",actual[9].getFormula(),"Formula is empty"); assertEquals("J1",actual[9].getAddress(),"Address is correct"); assertEquals("2018-01-13 00:00:00.0",actual[10].getFormattedValue(),"Formatted Value contains data type"); assertEquals("",actual[10].getComment(),"Comment is empty"); assertEquals("",actual[10].getFormula(),"Formula is empty"); assertEquals("K1",actual[10].getAddress(),"Address is correct"); assertEquals("This is a test",actual[11].getFormattedValue(),"Formatted Value contains data"); assertEquals("",actual[11].getComment(),"Comment is empty"); assertEquals("",actual[11].getFormula(),"Formula is empty"); assertEquals("L1",actual[11].getAddress(),"Address is correct"); assertNull(actual[12],"Null values stay null"); }