|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.esri.adf.web.data.tasks.validator.GenericValidator
com.esri.adf.web.data.tasks.validator.NumberValidator
public class NumberValidator
This class is used to define the validation rules to be enforced on a Task parameter which is numeric (byte, short, int, long, float, double, and corresponding Java wrapper classes).
For Example, TaskParamDescriptor paramDescriptor = ...; NumberValidator intValidator = new NumberValidator(Integer.class); intValidator.setInvalidMessage("Entered number is not valid."); intValidator.setPromptMessage("Enter the number between 1 and 99."); intValidator.setMinNumber(1); intValidator.setMaxNumber(99); paramDescriptor.setValidator(intValidator);
Field Summary |
---|
Fields inherited from class com.esri.adf.web.data.tasks.validator.GenericValidator |
---|
ADFDOJOTYPE |
Constructor Summary | |
---|---|
NumberValidator(Class<?> numberType)
Creates a NumberValidator object. |
Method Summary | |
---|---|
String |
getRangeMessage()
Specifies the message to display when the user enters a number that falls outside the permissible range defined by MinNumber and MaxNumber
properties. |
void |
setDecimalDigits(int digits)
Specifies the number of decimal digits to allow for float and double values. |
void |
setMaxNumber(double max)
Specifies the upper bound for the range of permissible values. |
void |
setMinNumber(double min)
Specifies the lower bound for the range of permissible values. |
void |
setRangeMessage(String rangeMessage)
Specifies the message to display when the user enters a number that falls outside the permissible range defined by MinNumber and MaxNumber
properties. |
Methods inherited from class com.esri.adf.web.data.tasks.validator.GenericValidator |
---|
addValidationRule, getInvalidMessage, getPromptMessage, getValidationRules, isRequired, removeValidationRule, setInvalidMessage, setPromptMessage, setRequired |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NumberValidator(Class<?> numberType)
For Example, NumberValidator intNumberValidator = new NumberValidator(Integer.class); intNumberValidator.setMinNumber(100); intNumberValidator.setMaxNumber(500);
numberType
- a Java supported numeric type class, like Double, Long etc.Method Detail |
---|
public String getRangeMessage()
MinNumber
and MaxNumber
properties.
public void setRangeMessage(String rangeMessage)
MinNumber
and MaxNumber
properties.
rangeMessage
- the error message to display.public void setMinNumber(double min) throws IllegalArgumentException
Integer.MIN_VALUE
.
NumberValidator intNumberValidator = new NumberValidator(Integer.class);
min
- the lower bound.
IllegalArgumentException
- if the specified value is lesser than what the number type permits.public void setMaxNumber(double max) throws IllegalArgumentException
Integer.MAX_VALUE
.
NumberValidator intNumberValidator = new NumberValidator(Integer.class);
max
- the upper bound.
IllegalArgumentException
- if the specified value is greater than what the number type permits.public void setDecimalDigits(int digits)
NumberValidator doubleNumberValidator = new NumberValidator(Double.class); doubleNumberValidator.setMinNumber(100); doubleNumberValidator.setMaxNumber(500); doubleNumberValidator.setDecimalDigits(4);
digits
- the number of decimal digits to allow.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |