arjansh commented on a change in pull request #234: MM-82 Detect Column Types
URL: https://github.com/apache/metamodel/pull/234#discussion_r355409910
 
 

 ##########
 File path: excel/src/main/java/org/apache/metamodel/excel/ExcelUtils.java
 ##########
 @@ -232,18 +230,93 @@ public static String getCellValue(Workbook wb, Cell 
cell) {
             throw new IllegalStateException("Unknown cell type: " + 
cell.getCellType());
         }
 
-        logger.debug("cell {} resolved to value: {}", cellCoordinate, result);
+        logger.debug("cell ({},{}) resolved to value: {}", cell.getRowIndex(), 
cell.getColumnIndex(), result);
 
         return result;
     }
 
+    private static Object getCellValueAsObject(final Workbook workbook, final 
Cell cell) {
+        if (cell == null) {
+            return null;
+        }
+
+        final Object result;
+
+        switch (cell.getCellType()) {
+        case BLANK:
+        case _NONE:
+            result = null;
+            break;
+        case BOOLEAN:
+            result = Boolean.valueOf(cell.getBooleanCellValue());
+            break;
+        case ERROR:
+            String errorResult;
 
 Review comment:
   This code looks like a carbon copy of the code above (lines 189-209). Maybe 
you can extract it into a `getErrorResult(Cell)` method which you reuse at both 
places.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to