Class FieldValidatorSupport
java.lang.Object
org.apache.struts2.validator.validators.ValidatorSupport
org.apache.struts2.validator.validators.FieldValidatorSupport
- All Implemented Interfaces:
FieldValidator,ShortCircuitableValidator,Validator
- Direct Known Subclasses:
DoubleRangeFieldValidator,FieldExpressionValidator,RangeValidatorSupport,RegexFieldValidator,RepopulateConversionErrorFieldValidatorSupport,RequiredFieldValidator,RequiredStringValidator,StringLengthFieldValidator,URLValidator,VisitorFieldValidator
Base class for field validators.
You can access fieldName and its currentValue in a message using expression, e.g.
"Wrong value ${currentValue} for ${fieldName}"
-
Field Summary
FieldsFields inherited from class org.apache.struts2.validator.validators.ValidatorSupport
defaultMessage, EMPTY_STRING, messageKey, stack, textProviderFactory -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the field name to be validatedGets the validator type used (see class javadoc).voidsetFieldName(String fieldName) Sets the field name to validate with this FieldValidatorvoidsetValidatorType(String type) Sets the validator type to use (see class javadoc).Methods inherited from class org.apache.struts2.validator.validators.ValidatorSupport
addActionError, addFieldError, getDefaultMessage, getFieldValue, getMessage, getMessageKey, getMessageParameters, getValidatorContext, isShortCircuit, parse, setDefaultMessage, setMessageKey, setMessageParameters, setShortCircuit, setTextProviderFactory, setValidatorContext, setValueStackMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.struts2.validator.Validator
getDefaultMessage, getMessage, getMessageKey, getMessageParameters, getValidatorContext, setDefaultMessage, setMessageKey, setMessageParameters, setValidatorContext, setValueStack, validate
-
Field Details
-
fieldName
-
type
-
currentValue
-
-
Constructor Details
-
FieldValidatorSupport
public FieldValidatorSupport()
-
-
Method Details
-
setFieldName
Description copied from interface:FieldValidatorSets the field name to validate with this FieldValidator- Specified by:
setFieldNamein interfaceFieldValidator- Parameters:
fieldName- the field name
-
getFieldName
Description copied from interface:FieldValidatorGets the field name to be validated- Specified by:
getFieldNamein interfaceFieldValidator- Returns:
- the field name
-
setValidatorType
Description copied from interface:ValidatorSets the validator type to use (see class javadoc).- Specified by:
setValidatorTypein interfaceValidator- Overrides:
setValidatorTypein classValidatorSupport- Parameters:
type- the type to use.
-
getValidatorType
Description copied from interface:ValidatorGets the validator type used (see class javadoc).- Specified by:
getValidatorTypein interfaceValidator- Overrides:
getValidatorTypein classValidatorSupport- Returns:
- the type used
-
getCurrentValue
-