|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.tapestry.valid.BaseValidator
org.apache.tapestry.valid.AbstractNumericValidator
org.apache.tapestry.valid.NumberValidator
public class NumberValidator
Simple validation for standard number classes. This is probably insufficient for anything tricky and application specific, such as parsing currency.
Nested Class Summary | |
---|---|
static class |
NumberValidator.NumberStrategy
This class is not meant for use outside of NumberValidator; it is public only to fascilitate some unit testing. |
Field Summary | |
---|---|
static int |
NUMBER_TYPE_INTEGER
|
static int |
NUMBER_TYPE_REAL
|
Fields inherited from class org.apache.tapestry.valid.BaseValidator |
---|
FIELD_SYMBOL, FORM_SYMBOL, FUNCTION_SYMBOL, VALIDATOR_SYMBOL |
Constructor Summary | |
---|---|
NumberValidator()
|
|
NumberValidator(String initializer)
Initializes the NumberValidator with properties defined by the initializer. |
Method Summary | |
---|---|
protected String |
getDefaultScriptPath()
|
boolean |
getHasMaximum()
|
boolean |
getHasMinimum()
|
Number |
getMaximum()
|
Number |
getMinimum()
|
static NumberValidator.NumberStrategy |
getStrategy(Class type)
Returns an strategy for the given type. |
Class |
getValueTypeClass()
Returns the value type to convert strings back into. |
boolean |
isIntegerNumber()
|
void |
renderValidatorContribution(IFormComponent field,
IMarkupWriter writer,
IRequestCycle cycle)
This implementation does nothing. |
void |
setMaximum(Number maximum)
|
void |
setMinimum(Number minimum)
|
void |
setValueType(String typeName)
Sets the value type from a string type name. |
void |
setValueTypeClass(Class valueTypeClass)
|
Object |
toObject(IFormComponent field,
String value)
Converts input, submitted by the client, into an object value. |
String |
toString(IFormComponent field,
Object value)
Invoked during rendering to convert an object value (which may be null) to a String. |
Methods inherited from class org.apache.tapestry.valid.BaseValidator |
---|
buildRequiredMessage, checkRequired, formatString, formatString, formatString, getPattern, getRequiredMessage, isClientScriptingEnabled, isRequired, processValidatorScript, setClientScriptingEnabled, setRequired, setRequiredMessage, setScriptSource |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int NUMBER_TYPE_INTEGER
public static final int NUMBER_TYPE_REAL
Constructor Detail |
---|
public NumberValidator()
public NumberValidator(String initializer)
Method Detail |
---|
public String toString(IFormComponent field, Object value)
IValidator
public static NumberValidator.NumberStrategy getStrategy(Class type)
Note: this method exists only for testing purposes. It is not meant to be invoked by user code and is subject to change at any time.
type
- the type (a Number subclass) for which to return an adaptor
public Object toObject(IFormComponent field, String value) throws ValidatorException
IValidator
The input string will already have been trimmed. It may be null.
ValidatorException
- if the string cannot be converted into an object, or the object is not valid (due
to other constraints).public Number getMaximum()
public boolean getHasMaximum()
public void setMaximum(Number maximum)
public Number getMinimum()
public boolean getHasMinimum()
public void setMinimum(Number minimum)
public void renderValidatorContribution(IFormComponent field, IMarkupWriter writer, IRequestCycle cycle)
BaseValidator
renderValidatorContribution
in interface IValidator
renderValidatorContribution
in class BaseValidator
public void setValueType(String typeName)
public void setValueTypeClass(Class valueTypeClass)
public Class getValueTypeClass()
public boolean isIntegerNumber()
protected String getDefaultScriptPath()
getDefaultScriptPath
in class AbstractNumericValidator
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |