public class ConditionalVisitorFieldValidator extends VisitorFieldValidator
<field name="colleaguePosition"> <field-validator type="conditionalvisitor"> <param name="expression">reason == 'colleague' and colleaguePositionID == 'OTHER'</param> <message>You must select reason Colleague and position Other</message> </field-validator> </field>
VisitorFieldValidator.AppendingValidatorContext
currentValue, fieldName, type
defaultMessage, EMPTY_STRING, messageKey, stack, textProviderFactory
Constructor and Description |
---|
ConditionalVisitorFieldValidator() |
Modifier and Type | Method and Description |
---|---|
String |
getExpression() |
void |
setExpression(String expression) |
void |
validate(Object object)
If expression evaluates to true, invoke visitor validation.
|
boolean |
validateExpression(Object object)
Validate the expression contained in the "expression" paramter.
|
getContext, isAppendPrefix, setActionValidatorManager, setAppendPrefix, setContext
getCurrentValue, getFieldName, getValidatorType, setFieldName, setValidatorType
addActionError, addFieldError, getDefaultMessage, getFieldValue, getMessage, getMessageKey, getMessageParameters, getValidatorContext, isShortCircuit, parse, setDefaultMessage, setMessageKey, setMessageParameters, setShortCircuit, setTextProviderFactory, setValidatorContext, setValueStack
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDefaultMessage, getMessage, getMessageKey, getMessageParameters, getValidatorContext, setDefaultMessage, setMessageKey, setMessageParameters, setValidatorContext, setValueStack
public void setExpression(String expression)
public String getExpression()
public void validate(Object object) throws ValidationException
validate
in interface Validator
validate
in class VisitorFieldValidator
object
- the object being validatedValidationException
- in case of validation problemspublic boolean validateExpression(Object object) throws ValidationException
object
- the object you're validatingValidationException
- if anything goes wrongCopyright © 2000–2020 Apache Software Foundation. All rights reserved.