]> gerrit.simantics Code Review - simantics/interop.git/commitdiff
Reducing use of deprecated code: using CellType enum instead of int for
authorMarko Luukkainen <marko.luukkainen@vtt.fi>
Fri, 3 Feb 2017 08:58:13 +0000 (10:58 +0200)
committerMarko Luukkainen <marko.luukkainen@vtt.fi>
Fri, 3 Feb 2017 08:58:13 +0000 (10:58 +0200)
cell types.

refs #7012

Change-Id: Ib8b8f2042e258a8ce811097112247a0c7c566ec9

org.simantics.excel.poi/src/org/simantics/excel/poi/parser/CellDataResolverBase.java

index 5a78735ded0099f60e1b965e0c29f0ed7352b4cc..6788b82f8d6c825d1318dae313f593df81e9e1d8 100644 (file)
@@ -9,20 +9,21 @@ public abstract class CellDataResolverBase<T> implements DataResolver<T> {
        protected Double getCellNumericValue(Cell cell) {\r
                if (cell == null)\r
                        return null;\r
-               switch (cell.getCellType()) {\r
-               case Cell.CELL_TYPE_BLANK:\r
+               switch (cell.getCellTypeEnum()) {\r
+               case BLANK:\r
                        return null;\r
-               case Cell.CELL_TYPE_BOOLEAN:\r
+               case BOOLEAN:\r
                        return null;\r
-               case Cell.CELL_TYPE_ERROR:\r
+               case ERROR:\r
                        return null;\r
-               case Cell.CELL_TYPE_FORMULA:\r
+               case FORMULA:\r
                        return null;\r
-               case Cell.CELL_TYPE_NUMERIC:\r
+               case NUMERIC:\r
                        return cell.getNumericCellValue();\r
-               case Cell.CELL_TYPE_STRING:\r
+               case STRING:\r
+                       return null;\r
+               case _NONE:\r
                        return null;\r
-                       \r
                }\r
                throw new RuntimeException();\r
        }\r
@@ -30,20 +31,21 @@ public abstract class CellDataResolverBase<T> implements DataResolver<T> {
        protected String getCellStringValue(Cell cell) {\r
                if (cell == null)\r
                        return null;\r
-               switch (cell.getCellType()) {\r
-               case Cell.CELL_TYPE_BLANK:\r
+               switch (cell.getCellTypeEnum()) {\r
+               case BLANK:\r
                        return null;\r
-               case Cell.CELL_TYPE_BOOLEAN:\r
+               case BOOLEAN:\r
                        return Boolean.toString(cell.getBooleanCellValue());\r
-               case Cell.CELL_TYPE_ERROR:\r
+               case ERROR:\r
                        return null;\r
-               case Cell.CELL_TYPE_FORMULA:\r
+               case FORMULA:\r
                        return null;\r
-               case Cell.CELL_TYPE_NUMERIC:\r
+               case NUMERIC:\r
                        return Double.toString(cell.getNumericCellValue());\r
-               case Cell.CELL_TYPE_STRING:\r
+               case STRING:\r
                        return cell.getStringCellValue();\r
-                       \r
+               case _NONE:\r
+                       return null;\r
                }\r
                throw new RuntimeException();\r
        }\r
@@ -51,24 +53,27 @@ public abstract class CellDataResolverBase<T> implements DataResolver<T> {
        protected Boolean getCellBooleanValue(Cell cell) {\r
                if (cell == null)\r
                        return null;\r
-               switch (cell.getCellType()) {\r
-               case Cell.CELL_TYPE_BLANK:\r
+               switch (cell.getCellTypeEnum()) {\r
+               case BLANK:\r
                        return null;\r
-               case Cell.CELL_TYPE_BOOLEAN:\r
+               case BOOLEAN:\r
                        return cell.getBooleanCellValue();\r
-               case Cell.CELL_TYPE_ERROR:\r
+               case ERROR:\r
                        return null;\r
-               case Cell.CELL_TYPE_FORMULA:\r
+               case FORMULA:\r
                        return null;\r
-               case Cell.CELL_TYPE_NUMERIC:\r
+               case NUMERIC:\r
                        return null;\r
-               case Cell.CELL_TYPE_STRING:\r
+               case STRING:\r
                        String value = cell.getStringCellValue();\r
                        if ("true".equalsIgnoreCase(value))\r
                                return true;\r
                        if ("1".equalsIgnoreCase(value))\r
                                return true;\r
-                       return false;           \r
+                       return false;\r
+               case _NONE:\r
+                       return null;\r
+               \r
                }\r
                throw new RuntimeException();\r
        }\r