public abstract class CustomValidator extends Validator
Modifier and Type | Field and Description |
---|---|
protected DataSourceField |
dataSourceField |
protected FormItem |
formItem |
protected Record |
record |
protected java.lang.Object |
resultingValue |
protected java.util.Map |
validatorProperties |
factoryCreated, factoryProperties, readOnly
Constructor and Description |
---|
CustomValidator() |
Modifier and Type | Method and Description |
---|---|
protected abstract boolean |
condition(java.lang.Object value)
Add custom validation logic by overriding this method.
|
DataSourceField |
getDataSourceField()
DataSourceField on which this validator was declared.
|
FormItem |
getFormItem()
FormItem on which this validator was declared.
|
Record |
getRecord() |
java.util.Map |
getValidatorProperties()
Return the properties of validator that is defined on the DataSourceField.
|
protected void |
setResultingValue(java.lang.Object resultingValue)
To transform the incoming value that is validated into a different value or format set this property from Validator.condition() to the desired value.
|
addValidatorDefinition, create, getClientOnly, getDependentFields, getOrCreateRef, getStopIfFalse, getStopOnError, getType, getTypeAsString, getValidateOnChange, setClientOnly, setDependentFields, setErrorMessage, setStopIfFalse, setStopOnError, setType, setType, setValidateOnChange
applyFactoryProperties, doAddHandler, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsDoubleArray, getAttributeAsFloat, getAttributeAsInt, getAttributeAsIntArray, getAttributeAsJavaScriptObject, getAttributeAsLong, getAttributeAsMap, getAttributeAsObject, getAttributeAsRecord, getAttributeAsString, getAttributeAsStringArray, getAttributes, getHandlerCount, getReadOnly, isFactoryCreated, logConfiguration, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributeAsJavaObject, setFactoryCreated, setReadOnly
protected FormItem formItem
protected DataSourceField dataSourceField
protected Record record
protected java.util.Map validatorProperties
protected java.lang.Object resultingValue
protected abstract boolean condition(java.lang.Object value)
getFormItem()
and getDataSourceField()
methods respectively and the field values for
record being validated can be obtained by calling getRecord()
.value
- value to validatepublic FormItem getFormItem()
getDataSourceField()
should be called.
NOTE: FormItem will not be available during a save performed without a form (eg programmatic save) or if the field.public DataSourceField getDataSourceField()
getFormItem()
should be called.public java.util.Map getValidatorProperties()
protected void setResultingValue(java.lang.Object resultingValue)
resultingValue
- the resulting valuepublic Record getRecord()