org.apache.poi.ss.formula
Enum DataValidationEvaluator.ValidationEnum

java.lang.Object
  extended by java.lang.Enum<DataValidationEvaluator.ValidationEnum>
      extended by org.apache.poi.ss.formula.DataValidationEvaluator.ValidationEnum
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<DataValidationEvaluator.ValidationEnum>
Enclosing class:
DataValidationEvaluator

public static enum DataValidationEvaluator.ValidationEnum
extends java.lang.Enum<DataValidationEvaluator.ValidationEnum>

Not calling it ValidationType to avoid confusion for now with DataValidationConstraint.ValidationType. Definition order matches OOXML type ID indexes


Enum Constant Summary
ANY
           
DATE
           
DECIMAL
           
FORMULA
           
INTEGER
           
LIST
           
TEXT_LENGTH
           
TIME
           
 
Method Summary
static boolean isValid(Cell cell, DataValidationEvaluator.DataValidationContext context)
          Validates against the type defined in context, as an index of the enum values array.
protected  boolean isValidNumericCell(Cell cell, DataValidationEvaluator.DataValidationContext context)
          Uses the cell value, which may be the cached formula result value.
protected  boolean isValidNumericValue(java.lang.Double value, DataValidationEvaluator.DataValidationContext context)
          Is the number a valid option for the validation?
 boolean isValidValue(Cell cell, DataValidationEvaluator.DataValidationContext context)
           
static DataValidationEvaluator.ValidationEnum valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static DataValidationEvaluator.ValidationEnum[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

ANY

public static final DataValidationEvaluator.ValidationEnum ANY

INTEGER

public static final DataValidationEvaluator.ValidationEnum INTEGER

DECIMAL

public static final DataValidationEvaluator.ValidationEnum DECIMAL

LIST

public static final DataValidationEvaluator.ValidationEnum LIST

DATE

public static final DataValidationEvaluator.ValidationEnum DATE

TIME

public static final DataValidationEvaluator.ValidationEnum TIME

TEXT_LENGTH

public static final DataValidationEvaluator.ValidationEnum TEXT_LENGTH

FORMULA

public static final DataValidationEvaluator.ValidationEnum FORMULA
Method Detail

values

public static DataValidationEvaluator.ValidationEnum[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (DataValidationEvaluator.ValidationEnum c : DataValidationEvaluator.ValidationEnum.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static DataValidationEvaluator.ValidationEnum valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

isValidValue

public boolean isValidValue(Cell cell,
                            DataValidationEvaluator.DataValidationContext context)

isValidNumericCell

protected boolean isValidNumericCell(Cell cell,
                                     DataValidationEvaluator.DataValidationContext context)
Uses the cell value, which may be the cached formula result value. We won't re-evaluate cells here. This validation would be after the cell value was updated externally. Excel allows invalid values through methods like copy/paste, and only validates them when the user interactively edits the cell.

Returns:
if the cell is a valid numeric cell for the validation or not

isValidNumericValue

protected boolean isValidNumericValue(java.lang.Double value,
                                      DataValidationEvaluator.DataValidationContext context)
Is the number a valid option for the validation?


isValid

public static boolean isValid(Cell cell,
                              DataValidationEvaluator.DataValidationContext context)
Validates against the type defined in context, as an index of the enum values array.

Parameters:
cell - Cell to check validity of
context - The Data Validation to check against
Returns:
true if validation passes
Throws:
java.lang.ArrayIndexOutOfBoundsException - if the constraint type is an invalid index