Author: fanningpj
Date: Mon Sep 18 10:50:50 2017
New Revision: 1808678
URL: http://svn.apache.org/viewvc?rev=1808678&view=rev
Log:
Change getCachedFormulaResultType to return CellType
Modified:
poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java
poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFEvaluationCell.java
poi/trunk/src/java/org/apache/poi/ss/formula/BaseFormulaEvaluator.java
poi/trunk/src/java/org/apache/poi/ss/formula/EvaluationCell.java
poi/trunk/src/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationCell.java
poi/trunk/src/java/org/apache/poi/ss/usermodel/Cell.java
poi/trunk/src/java/org/apache/poi/ss/usermodel/FormulaEvaluator.java
poi/trunk/src/java/org/apache/poi/ss/util/SheetUtil.java
poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFCell.java
poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFEvaluationCell.java
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFEvaluationCell.java
Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java?rev=1808678&r1=1808677&r2=1808678&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java Mon Sep 18
10:50:50 2017
@@ -55,6 +55,7 @@ import org.apache.poi.ss.util.CellRefere
import org.apache.poi.ss.util.NumberToTextConverter;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LocaleUtil;
+import org.apache.poi.util.Removal;
/**
* High level representation of a cell in a row of a spreadsheet.
@@ -1145,18 +1146,21 @@ public class HSSFCell implements Cell {
/**
* Only valid for formula cells
- *
- * Will return {@link CellType} in a future version of POI.
- * For forwards compatibility, do not hard-code cell type literals in your
code.
- *
* @return one of ({@link CellType#NUMERIC}, {@link CellType#STRING},
* {@link CellType#BOOLEAN}, {@link CellType#ERROR}) depending
* on the cached value of the formula
- * @deprecated 3.15. Will return a {@link CellType} enum in the future.
+ *
+ * @since POI 4.0
+ * @return <code>CellType</code> depending
+ * on the cached value of the formula
*/
@Override
- public int getCachedFormulaResultType() {
- return getCachedFormulaResultTypeEnum().getCode();
+ public CellType getCachedFormulaResultType() {
+ if (_cellType != CellType.FORMULA) {
+ throw new IllegalStateException("Only formula cells have cached
results");
+ }
+ int code =
((FormulaRecordAggregate)_record).getFormulaRecord().getCachedResultType();
+ return CellType.forInt(code);
}
/**
@@ -1165,15 +1169,14 @@ public class HSSFCell implements Cell {
* {@link CellType#BOOLEAN}, {@link CellType#ERROR}) depending
* on the cached value of the formula
* @since POI 3.15 beta 3
+ * @deprecated use <code>getCachedFormulaResultType</code>
* Will be deleted when we make the CellType enum transition. See bug
59791.
*/
+ @Deprecated
+ @Removal(version="4.2")
@Override
public CellType getCachedFormulaResultTypeEnum() {
- if (_cellType != CellType.FORMULA) {
- throw new IllegalStateException("Only formula cells have cached
results");
- }
- int code =
((FormulaRecordAggregate)_record).getFormulaRecord().getCachedResultType();
- return CellType.forInt(code);
+ return getCachedFormulaResultType();
}
void setCellArrayFormula(CellRangeAddress range) {
Modified:
poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFEvaluationCell.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFEvaluationCell.java?rev=1808678&r1=1808677&r2=1808678&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFEvaluationCell.java
(original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFEvaluationCell.java
Mon Sep 18 10:50:50 2017
@@ -21,6 +21,7 @@ import org.apache.poi.ss.formula.Evaluat
import org.apache.poi.ss.formula.EvaluationSheet;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.util.Removal;
/**
* HSSF wrapper for a cell under evaluation
@@ -107,23 +108,21 @@ final class HSSFEvaluationCell implement
}
/**
- * Will return {@link CellType} in a future version of POI.
- * For forwards compatibility, do not hard-code cell type literals in
your code.
- *
+ * @since POI 4.0
* @return cell type of cached formula result
- * @deprecated 3.15. Will return a {@link CellType} enum in the future.
*/
@Override
- public int getCachedFormulaResultType() {
- return _cell.getCachedFormulaResultType();
- }
+ public CellType getCachedFormulaResultType() { return
_cell.getCachedFormulaResultType(); }
+
/**
* @since POI 3.15 beta 3
* @deprecated POI 3.15 beta 3.
* Will be deleted when we make the CellType enum transition. See bug
59791.
*/
+ @Deprecated
+ @Removal(version = "4.2")
@Override
public CellType getCachedFormulaResultTypeEnum() {
- return _cell.getCachedFormulaResultTypeEnum();
+ return getCachedFormulaResultType();
}
}
Modified: poi/trunk/src/java/org/apache/poi/ss/formula/BaseFormulaEvaluator.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/BaseFormulaEvaluator.java?rev=1808678&r1=1808677&r2=1808678&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/BaseFormulaEvaluator.java
(original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/BaseFormulaEvaluator.java Mon
Sep 18 10:50:50 2017
@@ -27,6 +27,7 @@ import org.apache.poi.ss.usermodel.RichT
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.util.Removal;
/**
* Common functionality across file formats for evaluating formula cells.<p>
@@ -143,24 +144,33 @@ public abstract class BaseFormulaEvaluat
protected abstract CellValue evaluateFormulaCellValue(Cell cell);
/**
- * If cell contains formula, it evaluates the formula, and saves the
result of the formula. The
- * cell remains as a formula cell. If the cell does not contain formula,
this method returns -1
- * and leaves the cell unchanged.
- *
- * Note that the type of the <em>formula result</em> is returned, so you
know what kind of
- * cached formula result is also stored with the formula.
+ * If cell contains formula, it evaluates the formula,
+ * and saves the result of the formula. The cell
+ * remains as a formula cell.
+ * Else if cell does not contain formula, this method leaves
+ * the cell unchanged.
+ * Note that the type of the formula result is returned,
+ * so you know what kind of value is also stored with
+ * the formula.
* <pre>
- * int evaluatedCellType = evaluator.evaluateFormulaCell(cell);
+ * CellType evaluatedCellType = evaluator.evaluateFormulaCellEnum(cell);
* </pre>
- * Be aware that your cell will hold both the formula, and the result. If
you want the cell
- * replaced with the result of the formula, use {@link
#evaluateInCell(org.apache.poi.ss.usermodel.Cell)}
+ * Be aware that your cell will hold both the formula,
+ * and the result. If you want the cell replaced with
+ * the result of the formula, use {@link
#evaluate(org.apache.poi.ss.usermodel.Cell)} }
* @param cell The cell to evaluate
- * @return -1 for non-formula cells, or the type of the <em>formula
result</em>
- * @deprecated 3.15. Will return a {@link CellType} enum in the future.
+ * @return The type of the formula result (the cell's type remains as
CellType.FORMULA however)
+ * If cell is not a formula cell, returns {@link CellType#_NONE}
rather than throwing an exception.
*/
@Override
- public int evaluateFormulaCell(Cell cell) {
- return evaluateFormulaCellEnum(cell).getCode();
+ public CellType evaluateFormulaCell(Cell cell) {
+ if (cell == null || cell.getCellTypeEnum() != CellType.FORMULA) {
+ return CellType._NONE;
+ }
+ CellValue cv = evaluateFormulaCellValue(cell);
+ // cell remains a formula cell, but the cached value is changed
+ setCellValue(cell, cv);
+ return cv.getCellTypeEnum();
}
/**
@@ -182,16 +192,13 @@ public abstract class BaseFormulaEvaluat
* @return The type of the formula result (the cell's type remains as
CellType.FORMULA however)
* If cell is not a formula cell, returns {@link CellType#_NONE}
rather than throwing an exception.
* @since POI 3.15 beta 3
+ * @deprecated use <code>evaluateFormulaCell(cell)</code> instead
*/
+ @Deprecated
+ @Removal(version = "4.2")
@Override
public CellType evaluateFormulaCellEnum(Cell cell) {
- if (cell == null || cell.getCellTypeEnum() != CellType.FORMULA) {
- return CellType._NONE;
- }
- CellValue cv = evaluateFormulaCellValue(cell);
- // cell remains a formula cell, but the cached value is changed
- setCellValue(cell, cv);
- return cv.getCellTypeEnum();
+ return evaluateFormulaCell(cell);
}
protected static void setCellType(Cell cell, CellValue cv) {
Modified: poi/trunk/src/java/org/apache/poi/ss/formula/EvaluationCell.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/EvaluationCell.java?rev=1808678&r1=1808677&r2=1808678&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/EvaluationCell.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/EvaluationCell.java Mon Sep 18
10:50:50 2017
@@ -19,6 +19,7 @@ package org.apache.poi.ss.formula;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.util.Removal;
/**
* Abstracts a cell for the purpose of formula evaluation. This interface
represents both formula
@@ -61,17 +62,15 @@ public interface EvaluationCell {
boolean isPartOfArrayFormulaGroup();
/**
- * Will return {@link CellType} in a future version of POI.
- * For forwards compatibility, do not hard-code cell type literals in
your code.
- *
* @return cell type of cached formula result
- * @deprecated 3.15. Will return a {@link CellType} enum in the future.
*/
- int getCachedFormulaResultType();
+ CellType getCachedFormulaResultType();
/**
* @since POI 3.15 beta 3
* @deprecated POI 3.15 beta 3.
* Will be deleted when we make the CellType enum transition. See bug
59791.
*/
+ @Deprecated
+ @Removal(version = "4.2")
CellType getCachedFormulaResultTypeEnum();
}
Modified:
poi/trunk/src/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationCell.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationCell.java?rev=1808678&r1=1808677&r2=1808678&view=diff
==============================================================================
---
poi/trunk/src/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationCell.java
(original)
+++
poi/trunk/src/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationCell.java
Mon Sep 18 10:50:50 2017
@@ -28,6 +28,7 @@ import org.apache.poi.ss.formula.eval.Va
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.util.Removal;
/**
@@ -167,24 +168,23 @@ final class ForkedEvaluationCell impleme
return _masterCell.isPartOfArrayFormulaGroup();
}
/**
- * Will return {@link CellType} in a future version of POI.
- * For forwards compatibility, do not hard-code cell type literals in
your code.
- *
* @return cell type of cached formula result
- * @deprecated 3.15. Will return a {@link CellType} enum in the future.
*/
@Override
- public int getCachedFormulaResultType() {
+ public CellType getCachedFormulaResultType() {
return _masterCell.getCachedFormulaResultType();
}
+
/**
* @since POI 3.15 beta 3
* @deprecated POI 3.15 beta 3.
* Will be deleted when we make the CellType enum transition. See bug
59791.
*/
+ @Deprecated
+ @Removal(version = "4.2")
@Override
public CellType getCachedFormulaResultTypeEnum() {
- return _masterCell.getCachedFormulaResultTypeEnum();
+ return getCachedFormulaResultType();
}
}
Modified: poi/trunk/src/java/org/apache/poi/ss/usermodel/Cell.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/usermodel/Cell.java?rev=1808678&r1=1808677&r2=1808678&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/usermodel/Cell.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/usermodel/Cell.java Mon Sep 18
10:50:50 2017
@@ -198,10 +198,8 @@ public interface Cell {
* @return one of ({@link CellType#NUMERIC}, {@link CellType#STRING},
* {@link CellType#BOOLEAN}, {@link CellType#ERROR}) depending
* on the cached value of the formula
- * @deprecated 3.15. Will return a {@link CellType} enum in the future.
*/
- @Deprecated
- int getCachedFormulaResultType();
+ CellType getCachedFormulaResultType();
/**
* Only valid for formula cells
@@ -211,6 +209,8 @@ public interface Cell {
* @since POI 3.15 beta 3
* Will be renamed to <code>getCachedFormulaResultType()</code> when we
make the CellType enum transition in POI 4.0. See bug 59791.
*/
+ @Deprecated
+ @Removal(version = "4.2")
CellType getCachedFormulaResultTypeEnum();
/**
Modified: poi/trunk/src/java/org/apache/poi/ss/usermodel/FormulaEvaluator.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/usermodel/FormulaEvaluator.java?rev=1808678&r1=1808677&r2=1808678&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/usermodel/FormulaEvaluator.java
(original)
+++ poi/trunk/src/java/org/apache/poi/ss/usermodel/FormulaEvaluator.java Mon
Sep 18 10:50:50 2017
@@ -17,6 +17,8 @@
package org.apache.poi.ss.usermodel;
+import org.apache.poi.util.Removal;
+
import java.util.Map;
/**
@@ -99,9 +101,8 @@ public interface FormulaEvaluator {
* or one of {@link CellType#NUMERIC}, {@link CellType#STRING},
* {@link CellType#BOOLEAN}, {@link CellType#ERROR}
* Note: the cell's type remains as CellType.FORMULA however.
- * @deprecated 3.15. Will return a {@link CellType} enum in the future
*/
- int evaluateFormulaCell(Cell cell);
+ CellType evaluateFormulaCell(Cell cell);
/**
* If cell contains formula, it evaluates the formula,
@@ -123,7 +124,10 @@ public interface FormulaEvaluator {
* or one of {@link CellType#NUMERIC}, {@link CellType#STRING},
* {@link CellType#BOOLEAN}, {@link CellType#ERROR}
* Note: the cell's type remains as CellType.FORMULA however.
+ * @deprecated use <code>evaluateFormulaCell(cell)</code>
*/
+ @Deprecated
+ @Removal(version = "4.2")
CellType evaluateFormulaCellEnum(Cell cell);
/**
Modified: poi/trunk/src/java/org/apache/poi/ss/util/SheetUtil.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/util/SheetUtil.java?rev=1808678&r1=1808677&r2=1808678&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/util/SheetUtil.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/util/SheetUtil.java Mon Sep 18
10:50:50 2017
@@ -38,6 +38,7 @@ import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.util.Internal;
+import org.apache.poi.util.Removal;
/**
@@ -90,19 +91,16 @@ public class SheetUtil {
@Override
public void evaluateAll() {}
@Override
- public int evaluateFormulaCell(Cell cell) {
- //noinspection deprecation
- return cell.getCachedFormulaResultType();
- }
- /**
+ public CellType evaluateFormulaCell(Cell cell) { return
cell.getCachedFormulaResultType(); }
+ /**
* @since POI 3.15 beta 3
* @deprecated POI 3.15 beta 3. Will be deleted when we make the
CellType enum transition. See bug 59791.
*/
+ @Deprecated
+ @Removal(version = "4.2")
@Internal(since="POI 3.15 beta 3")
@Override
- public CellType evaluateFormulaCellEnum(Cell cell) {
- return cell.getCachedFormulaResultTypeEnum();
- }
+ public CellType evaluateFormulaCellEnum(Cell cell) { return
evaluateFormulaCell(cell); }
};
/**
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFCell.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFCell.java?rev=1808678&r1=1808677&r2=1808678&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFCell.java
(original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFCell.java Mon
Sep 18 10:50:50 2017
@@ -38,10 +38,7 @@ import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.util.CellAddress;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.ss.util.CellReference;
-import org.apache.poi.util.LocaleUtil;
-import org.apache.poi.util.NotImplemented;
-import org.apache.poi.util.POILogFactory;
-import org.apache.poi.util.POILogger;
+import org.apache.poi.util.*;
import org.apache.poi.xssf.usermodel.XSSFHyperlink;
import org.apache.poi.xssf.usermodel.XSSFRichTextString;
@@ -175,12 +172,14 @@ public class SXSSFCell implements Cell {
* @return one of ({@link CellType#NUMERIC}, {@link CellType#STRING},
* {@link CellType#BOOLEAN}, {@link CellType#ERROR}) depending
* on the cached value of the formula
- * @deprecated 3.15. Will return a {@link CellType} enum in the future.
*/
@Override
- public int getCachedFormulaResultType()
- {
- return getCachedFormulaResultTypeEnum().getCode();
+ public CellType getCachedFormulaResultType() {
+ if (_value.getType() != CellType.FORMULA) {
+ throw new IllegalStateException("Only formula cells have cached
results");
+ }
+
+ return ((FormulaValue)_value).getFormulaType();
}
/**
@@ -189,16 +188,13 @@ public class SXSSFCell implements Cell {
* {@link CellType#BOOLEAN}, {@link CellType#ERROR}) depending
* on the cached value of the formula
* @since POI 3.15 beta 3
- * Will be deleted when we make the CellType enum transition. See bug
59791.
+ * @deprecated use <code>getCachedFormulaResultTypeEnum</code> instead
*/
+ @Deprecated
+ @Removal(version = "4.2")
@Override
- public CellType getCachedFormulaResultTypeEnum()
- {
- if (_value.getType() != CellType.FORMULA) {
- throw new IllegalStateException("Only formula cells have cached
results");
- }
-
- return ((FormulaValue)_value).getFormulaType();
+ public CellType getCachedFormulaResultTypeEnum() {
+ return getCachedFormulaResultType();
}
/**
Modified:
poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFEvaluationCell.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFEvaluationCell.java?rev=1808678&r1=1808677&r2=1808678&view=diff
==============================================================================
---
poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFEvaluationCell.java
(original)
+++
poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFEvaluationCell.java
Mon Sep 18 10:50:50 2017
@@ -22,6 +22,7 @@ import org.apache.poi.ss.formula.Evaluat
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.util.Internal;
+import org.apache.poi.util.Removal;
/**
* SXSSF wrapper for a cell under evaluation
@@ -110,24 +111,22 @@ final class SXSSFEvaluationCell implemen
}
/**
- * Will return {@link CellType} in a future version of POI.
- * For forwards compatibility, do not hard-code cell type literals in your
code.
- *
* @return cell type of cached formula result
- * @deprecated 3.17. Will return a {@link CellType} enum in the future.
*/
@Override
- public int getCachedFormulaResultType() {
- return _cell.getCachedFormulaResultType();
+ public CellType getCachedFormulaResultType() {
+ return _cell.getCachedFormulaResultTypeEnum();
}
/**
* @since POI 3.15 beta 3
* @deprecated POI 3.15 beta 3.
* Will be deleted when we make the CellType enum transition. See bug
59791.
*/
+ @Deprecated
+ @Removal(version = "4.2")
@Internal(since="POI 3.15 beta 3")
@Override
public CellType getCachedFormulaResultTypeEnum() {
- return _cell.getCachedFormulaResultTypeEnum();
+ return getCachedFormulaResultType();
}
}
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java?rev=1808678&r1=1808677&r2=1808678&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java
(original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java Mon
Sep 18 10:50:50 2017
@@ -714,20 +714,17 @@ public final class XSSFCell implements C
/**
* Only valid for formula cells
- *
- * Will return {@link CellType} in a future version of POI.
- * For forwards compatibility, do not hard-code cell type literals in your
code.
- *
* @return one of ({@link CellType#NUMERIC}, {@link CellType#STRING},
* {@link CellType#BOOLEAN}, {@link CellType#ERROR}) depending
* on the cached value of the formula
- * @deprecated 3.15. Will return a {@link CellType} enum in the future.
*/
- @Deprecated
@Override
- @Removal(version="3.17")
- public int getCachedFormulaResultType() {
- return getCachedFormulaResultTypeEnum().getCode();
+ public CellType getCachedFormulaResultType() {
+ if (! isFormulaCell()) {
+ throw new IllegalStateException("Only formula cells have cached
results");
+ }
+
+ return getBaseCellType(false);
}
/**
@@ -736,15 +733,14 @@ public final class XSSFCell implements C
* {@link CellType#BOOLEAN}, {@link CellType#ERROR}) depending
* on the cached value of the formula
* @since POI 3.15 beta 3
+ * @deprecated use <code>getCachedFormulaResultType</code> instead
* Will be deleted when we make the CellType enum transition. See bug
59791.
*/
+ @Deprecated
+ @Removal(version = "4.2")
@Override
public CellType getCachedFormulaResultTypeEnum() {
- if (! isFormulaCell()) {
- throw new IllegalStateException("Only formula cells have cached
results");
- }
-
- return getBaseCellType(false);
+ return getCachedFormulaResultType();
}
/**
Modified:
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFEvaluationCell.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFEvaluationCell.java?rev=1808678&r1=1808677&r2=1808678&view=diff
==============================================================================
---
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFEvaluationCell.java
(original)
+++
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFEvaluationCell.java
Mon Sep 18 10:50:50 2017
@@ -22,6 +22,7 @@ import org.apache.poi.ss.formula.Evaluat
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.util.Internal;
+import org.apache.poi.util.Removal;
/**
* XSSF wrapper for a cell under evaluation
@@ -110,24 +111,22 @@ final class XSSFEvaluationCell implement
}
/**
- * Will return {@link CellType} in a future version of POI.
- * For forwards compatibility, do not hard-code cell type literals in
your code.
- *
* @return cell type of cached formula result
- * @deprecated 3.17. Will return a {@link CellType} enum in the future.
*/
@Override
- public int getCachedFormulaResultType() {
- return _cell.getCachedFormulaResultType();
+ public CellType getCachedFormulaResultType() {
+ return _cell.getCachedFormulaResultTypeEnum();
}
/**
* @since POI 3.15 beta 3
* @deprecated POI 3.15 beta 3.
* Will be deleted when we make the CellType enum transition. See bug
59791.
*/
+ @Deprecated
+ @Removal(version = "4.2")
@Internal(since="POI 3.15 beta 3")
@Override
public CellType getCachedFormulaResultTypeEnum() {
- return _cell.getCachedFormulaResultTypeEnum();
+ return getCachedFormulaResultType();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]