CellType type)
{
checkBounds(col);
- _cellType = CellType._UNINITIALIZED; // Force 'setCellType' to create a first Record
+ _cellType = CellType._NONE; // Force 'setCellType' to create a first Record
_stringValue = null;
_book = book;
_sheet = sheet;
throw new IllegalStateException("Invalid cell type: " + cellType);
}
if (cellType != _cellType &&
- _cellType != CellType._UNINITIALIZED ) // Special Value to indicate an uninitialized Cell
+ _cellType != CellType._NONE ) // Special Value to indicate an uninitialized Cell
{
_sheet.getSheet().replaceValueRecord(_record);
}
* @deprecated POI 3.15 beta 3
* Will be deleted when we make the CellType enum transition. See bug 59791.
*/
- @Internal
+ @Internal(since="POI 3.15 beta 3")
@Override
public CellType getCellTypeEnum()
{
* @deprecated POI 3.15 beta 3
* Will be deleted when we make the CellType enum transition. See bug 59791.
*/
- @Internal
+ @Internal(since="POI 3.15 beta 3")
@Override
public CellType getCachedFormulaResultTypeEnum() {
if (_cellType != CellType.FORMULA) {
* @deprecated POI 3.15 beta 3.
* Will be deleted when we make the CellType enum transition. See bug 59791.
*/
- @Internal
+ @Internal(since="POI 3.15 beta 3")
@Override
public CellType getCellTypeEnum() {
return _cell.getCellTypeEnum();
* @deprecated POI 3.15 beta 3.
* Will be deleted when we make the CellType enum transition. See bug 59791.
*/
- @Internal\r
+ @Internal(since="POI 3.15 beta 3")
@Override
public CellType getCachedFormulaResultTypeEnum() {\r
return _cell.getCachedFormulaResultTypeEnum();\r
/**
* 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.
+ * cell remains as a formula cell. If the cell does not contain formula, rather than throwing an
+ * exception, this method returns {@link CellType#_NONE} 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.
* <pre>
- * int evaluatedCellType = evaluator.evaluateFormulaCell(cell);
+ * CellType evaluatedCellType = evaluator.evaluateFormulaCell(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)}
* @param cell The cell to evaluate
- * @return -1 for non-formula cells, or the type of the <em>formula result</em>
+ * @return {@link CellType#_NONE} for non-formula cells, or the type of the <em>formula result</em>
+ * @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.
*/
@Internal
@Override
public CellType evaluateFormulaCellEnum(Cell cell) {
if (cell == null || cell.getCellTypeEnum() != CellType.FORMULA) {
- return CellType._UNINITIALIZED;
+ return CellType._NONE;
}
CellValue cv = evaluateFormulaCellValue(cell);
// cell remains a formula cell, but the cached value is changed
* @deprecated POI 3.15 beta 3
* Will be deleted when we make the CellType enum transition. See bug 59791.
*/
- @Internal
+ @Internal(since="POI 3.15 beta 3")
public static CellType ultimateTypeEnum(Cell cell) {
CellType type = cell.getCellTypeEnum();
if (type == CellType.FORMULA)
* @deprecated POI 3.15 beta 3.
* Will be deleted when we make the CellType enum transition. See bug 59791.
*/
- @Internal
+ @Internal(since="POI 3.15 beta 3")
@Override
public CellType getCellTypeEnum() {
return _cellType;
* @deprecated POI 3.15 beta 3.
* Will be deleted when we make the CellType enum transition. See bug 59791.
*/
- @Internal
+ @Internal(since="POI 3.15 beta 3")
@Override
public CellType getCachedFormulaResultTypeEnum() {
return _masterCell.getCachedFormulaResultTypeEnum();
* @deprecated POI 3.15 beta 3
* Will be deleted when we make the CellType enum transition. See bug 59791.
*/
- @Internal
+ @Internal(since="POI 3.15 beta 3")
CellType getCellTypeEnum();
/**
* @deprecated POI 3.15 beta 3
* Will be deleted when we make the CellType enum transition. See bug 59791.
*/
- @Internal
+ @Internal(since="POI 3.15 beta 3")
CellType getCachedFormulaResultTypeEnum();
/**
* @since POI 3.15 beta 3
*/
public enum CellType {
- @Internal
- _UNINITIALIZED(-1),
+ /**
+ * Unknown type, used to represent a state prior to initialization or the
+ * lack of a concrete type.
+ * For internal use only.
+ */
+ @Internal(since="POI 3.15 beta 3")
+ _NONE(-1),
- /** Numeric cell type (whole numbers, fractional numbers, dates) */
+ /**
+ * Numeric cell type (whole numbers, fractional numbers, dates)
+ */
NUMERIC(0),
- /** String cell type */
+ /** String (text) cell type */
STRING(1),
/**
* Note: the cell's type remains as CellType.FORMULA however.
* @deprecated POI 3.15 beta 3. Will be deleted when we make the CellType enum transition. See bug 59791.
*/
- @Internal
+ @Internal(since="POI 3.15 beta 3")
CellType evaluateFormulaCellEnum(Cell cell);
/**
public int evaluateFormulaCell(Cell cell) {
return cell.getCachedFormulaResultType();
}
- /** @deprecated POI 3.15 beta 3. Will be deleted when we make the CellType enum transition. See bug 59791. */
- @Internal
+ /**
+ * @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.
+ */
+ @Internal(since="POI 3.15 beta 3")
@Override
public CellType evaluateFormulaCellEnum(Cell cell) {
return cell.getCachedFormulaResultTypeEnum();
* @author Marc Johnson (mjohnson at apache dot org)
* @author Andrew C. Oliver (acoliver at apache dot org)
*/
-@Internal
+@Internal(since="POI 3.15 beta 3")
public class BitField
{
private final int _mask;
* @deprecated POI 3.15 beta 3
* Will be deleted when we make the CellType enum transition. See bug 59791.
*/
- @Internal
+ @Internal(since="POI 3.15 beta 3")
@Override
public CellType getCellTypeEnum()
{
* @deprecated POI 3.15 beta 3.
* Will be deleted when we make the CellType enum transition. See bug 59791.
*/
- @Internal
+ @Internal(since="POI 3.15 beta 3")
@Override
public CellType getCachedFormulaResultTypeEnum()
{
* @deprecated POI 3.15 beta 3.
* Will be deleted when we make the CellType enum transition. See bug 59791.
*/
- @Internal
+ @Internal(since="POI 3.15 beta 3")
@Override
public CellType getCellTypeEnum() {
return _cell.getCellTypeEnum();
* @deprecated POI 3.15 beta 3.
* Will be deleted when we make the CellType enum transition. See bug 59791.
*/
- @Internal\r
+ @Internal(since="POI 3.15 beta 3")
@Override
public CellType getCachedFormulaResultTypeEnum() {\r
return _cell.getCachedFormulaResultTypeEnum();\r
* the result of the formula, use {@link #evaluate(org.apache.poi.ss.usermodel.Cell)} }
* @param cell The cell to evaluate
* @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 POI 3.15 beta 3. Will be deleted when we make the CellType enum transition. See bug 59791.
*/
- @Internal
+ @Internal(since="POI 3.15 beta 3")
public CellType evaluateFormulaCellEnum(Cell cell) {
if (cell == null || cell.getCellTypeEnum() != CellType.FORMULA) {
- return CellType._UNINITIALIZED;
+ return CellType._NONE;
}
CellValue cv = evaluateFormulaCellValue(cell);
// cell remains a formula cell, but the cached value is changed
* @deprecated POI 3.15 beta 3
* Will be deleted when we make the CellType enum transition. See bug 59791.
*/
- @Internal
+ @Internal(since="POI 3.15 beta 3")
@Override
public CellType getCellTypeEnum() {
if (isFormulaCell()) return CellType.FORMULA;
* @deprecated POI 3.15 beta 3
* Will be deleted when we make the CellType enum transition. See bug 59791.
*/
- @Internal
+ @Internal(since="POI 3.15 beta 3")
@Override
public CellType getCachedFormulaResultTypeEnum() {
if (! isFormulaCell()) {
* @deprecated POI 3.15 beta 3.
* Will be deleted when we make the CellType enum transition. See bug 59791.
*/
- @Internal
+ @Internal(since="POI 3.15 beta 3")
@Override
public CellType getCellTypeEnum() {
return _cell.getCellTypeEnum();
* @deprecated POI 3.15 beta 3.
* Will be deleted when we make the CellType enum transition. See bug 59791.
*/
- @Internal\r
+ @Internal(since="POI 3.15 beta 3")
@Override
public CellType getCachedFormulaResultTypeEnum() {\r
return _cell.getCachedFormulaResultTypeEnum();\r
/**
* get the underlying CTTable XML bean
*/
- @Internal
+ @Internal(since="POI 3.15 beta 3")
public CTTable getCTTable() {
return ctTable;
}
cell = row.getCell(1);
assertEquals(CellType.BLANK, cell.getCellTypeEnum());
- assertEquals(CellType._UNINITIALIZED, evaluator.evaluateFormulaCellEnum(cell));
+ assertEquals(CellType._NONE, evaluator.evaluateFormulaCellEnum(cell));
// A3
row = worksheet.getRow(2);