Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.poi.hssf.usermodel
Class DVConstraint

    java.lang.Object
      org.apache.poi.hssf.usermodel.DVConstraint

All Implemented Interfaces:
  DataValidationConstraint

    public class DVConstraint

extends java.lang.Object
implements DataValidationConstraint

Author:
  Josh Micich

Nested Class Summary
`static class` | `DVConstraint.FormulaPair`

Nested classes/interfaces inherited from interface org.apache.poi.ss.usermodel.DataValidationConstraint
`DataValidationConstraint.OperatorType, DataValidationConstraint.ValidationType`

Method Summary
`static DVConstraint` | `createCustomFormulaConstraint(java.lang.String formula)`
`static DVConstraint` | `createDateConstraint(int comparisonOperator, java.lang.String expr1, java.lang.String expr2, java.lang.String dateFormat)` Creates a date based data validation constraint.
`static DVConstraint` | `createExplicitListConstraint(java.lang.String[] explicitListValues)`
`static DVConstraint` | `createFormulaListConstraint(java.lang.String listFormula)`
`static DVConstraint` | `createNumericConstraint(int validationType, int comparisonOperator, java.lang.String expr1, java.lang.String expr2)` Creates a number based data validation constraint.
`static DVConstraint` | `createTimeConstraint(int comparisonOperator, java.lang.String expr1, java.lang.String expr2)` Creates a time based data validation constraint.
`java.lang.String[]` | `getExplicitListValues()`
`java.lang.String` | `getFormula1()`
`java.lang.String` | `getFormula2()`
`int` | `getOperator()`
`int` | `getValidationType()`
`java.lang.Double` | `getValue1()`
`java.lang.Double` | `getValue2()`
`boolean` | `isExplicitList()` Convenience method
`boolean` | `isListValidationType()` Convenience method
`void` | `setExplicitListValues(java.lang.String[] explicitListValues)`
`void` | `setFormula1(java.lang.String formula1)` Sets a formula for expression 1.
`void` | `setFormula2(java.lang.String formula2)` Sets a formula for expression 2.
`void` | `setOperator(int operator)` Sets the comparison operator for this constraint
`void` | `setValue1(double value1)` Sets a numeric value for expression 1.
`void` | `setValue2(double value2)` Sets a numeric value for expression 2.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### createNumericConstraint

    public static DVConstraint createNumericConstraint(int validationType,
                                                       int comparisonOperator,
                                                       java.lang.String expr1,
                                                       java.lang.String expr2)

  Creates a number based data validation constraint. The text values entered for expr1 and expr2 can be either standard Excel formulas or formatted number values. If the expression starts with '=' it is parsed as a formula, otherwise it is parsed as a formatted number.

  Parameters:
    `validationType` - one of `DataValidationConstraint.ValidationType.ANY`, `DataValidationConstraint.ValidationType.DECIMAL`, `DataValidationConstraint.ValidationType.INTEGER`, `DataValidationConstraint.ValidationType.TEXT_LENGTH`
    `comparisonOperator` - any constant from `DataValidationConstraint.OperatorType` enum
    `expr1` - date formula (when first char is '=') or formatted number value
    `expr2` - date formula (when first char is '=') or formatted number value

### createFormulaListConstraint

    public static DVConstraint createFormulaListConstraint(java.lang.String listFormula)

### createExplicitListConstraint

    public static DVConstraint createExplicitListConstraint(java.lang.String[] explicitListValues)

### createTimeConstraint

    public static DVConstraint createTimeConstraint(int comparisonOperator,
                                                    java.lang.String expr1,
                                                    java.lang.String expr2)

  Creates a time based data validation constraint. The text values entered for expr1 and expr2 can be either standard Excel formulas or formatted time values. If the expression starts with '=' it is parsed as a formula, otherwise it is parsed as a formatted time. To parse formatted times, two formats are supported: "HH:MM" or "HH:MM:SS". This is contrary to Excel which uses the default time format from the OS.

  Parameters:
    `comparisonOperator` - constant from `DataValidationConstraint.OperatorType` enum
    `expr1` - date formula (when first char is '=') or formatted time value
    `expr2` - date formula (when first char is '=') or formatted time value

### createDateConstraint

    public static DVConstraint createDateConstraint(int comparisonOperator,
                                                    java.lang.String expr1,
                                                    java.lang.String expr2,
                                                    java.lang.String dateFormat)

  Creates a date based data validation constraint. The text values entered for expr1 and expr2 can be either standard Excel formulas or formatted date values. If the expression starts with '=' it is parsed as a formula, otherwise it is parsed as a formatted date (Excel uses the same convention). To parse formatted dates, a date format needs to be specified. This is contrary to Excel which uses the default short date format from the OS.

  Parameters:
    `comparisonOperator` - constant from `DataValidationConstraint.OperatorType` enum
    `expr1` - date formula (when first char is '=') or formatted date value
    `expr2` - date formula (when first char is '=') or formatted date value
    `dateFormat` - ignored if both expr1 and expr2 are formulas. Default value is "YYYY/MM/DD" otherwise any other valid argument for `SimpleDateFormat` can be used
  See Also:
    SimpleDateFormat

### createCustomFormulaConstraint

    public static DVConstraint createCustomFormulaConstraint(java.lang.String formula)

### getValidationType

    public int getValidationType()

  Specified by:
    `getValidationType` in interface `DataValidationConstraint`
  Returns:
    data validation type of this constraint
  See Also:
    `DataValidationConstraint.ValidationType`

### isListValidationType

    public boolean isListValidationType()

  Convenience method

  Returns:
    `true` if this constraint is a 'list' validation

### isExplicitList

    public boolean isExplicitList()

  Convenience method

  Returns:
    `true` if this constraint is a 'list' validation with explicit values

### getOperator

    public int getOperator()

  Specified by:
    `getOperator` in interface `DataValidationConstraint`
  Returns:
    the operator used for this constraint
  See Also:
    `DataValidationConstraint.OperatorType`

### setOperator

    public void setOperator(int operator)

  Description copied from interface: `DataValidationConstraint`
  Sets the comparison operator for this constraint

  Specified by:
    `setOperator` in interface `DataValidationConstraint`
  See Also:
    `DataValidationConstraint.OperatorType`

### getExplicitListValues

    public java.lang.String[] getExplicitListValues()

  Specified by:
    `getExplicitListValues` in interface `DataValidationConstraint`

### setExplicitListValues

    public void setExplicitListValues(java.lang.String[] explicitListValues)

  Specified by:
    `setExplicitListValues` in interface `DataValidationConstraint`

### getFormula1

    public java.lang.String getFormula1()

  Specified by:
    `getFormula1` in interface `DataValidationConstraint`
  Returns:
    the formula for expression 1. May be `null`

### setFormula1

    public void setFormula1(java.lang.String formula1)

  Description copied from interface: `DataValidationConstraint`
  Sets a formula for expression 1.

  Specified by:
    `setFormula1` in interface `DataValidationConstraint`

### getFormula2

    public java.lang.String getFormula2()

  Specified by:
    `getFormula2` in interface `DataValidationConstraint`
  Returns:
    the formula for expression 2. May be `null`

### setFormula2

    public void setFormula2(java.lang.String formula2)

  Description copied from interface: `DataValidationConstraint`
  Sets a formula for expression 2.

  Specified by:
    `setFormula2` in interface `DataValidationConstraint`

### getValue1

    public java.lang.Double getValue1()

  Returns:
    the numeric value for expression 1. May be `null`

### setValue1

    public void setValue1(double value1)

  Sets a numeric value for expression 1.

### getValue2

    public java.lang.Double getValue2()

  Returns:
    the numeric value for expression 2. May be `null`

### setValue2

    public void setValue2(double value2)

  Sets a numeric value for expression 2.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD