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).void
setFieldName
(String fieldName) Sets the field name to validate with this FieldValidatorvoid
setValidatorType
(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, setValueStack
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:FieldValidator
Sets the field name to validate with this FieldValidator- Specified by:
setFieldName
in interfaceFieldValidator
- Parameters:
fieldName
- the field name
-
getFieldName
Description copied from interface:FieldValidator
Gets the field name to be validated- Specified by:
getFieldName
in interfaceFieldValidator
- Returns:
- the field name
-
setValidatorType
Description copied from interface:Validator
Sets the validator type to use (see class javadoc).- Specified by:
setValidatorType
in interfaceValidator
- Overrides:
setValidatorType
in classValidatorSupport
- Parameters:
type
- the type to use.
-
getValidatorType
Description copied from interface:Validator
Gets the validator type used (see class javadoc).- Specified by:
getValidatorType
in interfaceValidator
- Overrides:
getValidatorType
in classValidatorSupport
- Returns:
- the type used
-
getCurrentValue
-