public class DVConstraint extends Object implements DataValidationConstraint
Modifier and Type | Class and Description |
---|---|
static class |
DVConstraint.FormulaPair |
DataValidationConstraint.OperatorType, DataValidationConstraint.ValidationType
Modifier and Type | Method and Description |
---|---|
static DVConstraint |
createCustomFormulaConstraint(String formula) |
static DVConstraint |
createDateConstraint(int comparisonOperator,
String expr1,
String expr2,
String dateFormat)
Creates a date based data validation constraint.
|
static DVConstraint |
createExplicitListConstraint(String[] explicitListValues) |
static DVConstraint |
createFormulaListConstraint(String listFormula) |
static DVConstraint |
createNumericConstraint(int validationType,
int comparisonOperator,
String expr1,
String expr2)
Creates a number based data validation constraint.
|
static DVConstraint |
createTimeConstraint(int comparisonOperator,
String expr1,
String expr2)
Creates a time based data validation constraint.
|
boolean |
equals(Object other) |
String[] |
getExplicitListValues() |
String |
getFormula1() |
String |
getFormula2() |
int |
getOperator() |
int |
getValidationType() |
Double |
getValue1() |
Double |
getValue2() |
int |
hashCode() |
boolean |
isExplicitList()
Convenience method
|
boolean |
isListValidationType()
Convenience method
|
void |
setExplicitListValues(String[] explicitListValues) |
void |
setFormula1(String formula1)
Sets a formula for expression 1.
|
void |
setFormula2(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.
|
public static DVConstraint createNumericConstraint(int validationType, int comparisonOperator, String expr1, String expr2)
validationType
- one of DataValidationConstraint.ValidationType.ANY
,
DataValidationConstraint.ValidationType.DECIMAL
,
DataValidationConstraint.ValidationType.INTEGER
,
DataValidationConstraint.ValidationType.TEXT_LENGTH
comparisonOperator
- any constant from DataValidationConstraint.OperatorType
enumexpr1
- date formula (when first char is '=') or formatted number valueexpr2
- date formula (when first char is '=') or formatted number valuepublic static DVConstraint createFormulaListConstraint(String listFormula)
public static DVConstraint createExplicitListConstraint(String[] explicitListValues)
public static DVConstraint createTimeConstraint(int comparisonOperator, String expr1, String expr2)
comparisonOperator
- constant from DataValidationConstraint.OperatorType
enumexpr1
- date formula (when first char is '=') or formatted time valueexpr2
- date formula (when first char is '=') or formatted time valuepublic static DVConstraint createDateConstraint(int comparisonOperator, String expr1, String expr2, String dateFormat)
comparisonOperator
- constant from DataValidationConstraint.OperatorType
enumexpr1
- date formula (when first char is '=') or formatted date valueexpr2
- date formula (when first char is '=') or formatted date valuedateFormat
- ignored if both expr1 and expr2 are formulas. Default value is "YYYY/MM/DD"
otherwise any other valid argument for SimpleDateFormat can be usedpublic static DVConstraint createCustomFormulaConstraint(String formula)
public int getValidationType()
getValidationType
in interface DataValidationConstraint
DataValidationConstraint.ValidationType
public boolean isListValidationType()
true
if this constraint is a 'list' validationpublic boolean isExplicitList()
true
if this constraint is a 'list' validation with explicit valuespublic int getOperator()
getOperator
in interface DataValidationConstraint
DataValidationConstraint.OperatorType
public void setOperator(int operator)
DataValidationConstraint
setOperator
in interface DataValidationConstraint
DataValidationConstraint.OperatorType
public String[] getExplicitListValues()
getExplicitListValues
in interface DataValidationConstraint
public void setExplicitListValues(String[] explicitListValues)
setExplicitListValues
in interface DataValidationConstraint
public String getFormula1()
getFormula1
in interface DataValidationConstraint
null
public void setFormula1(String formula1)
DataValidationConstraint
setFormula1
in interface DataValidationConstraint
public String getFormula2()
getFormula2
in interface DataValidationConstraint
null
public void setFormula2(String formula2)
DataValidationConstraint
setFormula2
in interface DataValidationConstraint
public Double getValue1()
null
public void setValue1(double value1)
public Double getValue2()
null
public void setValue2(double value2)
Copyright © 2020. All rights reserved.