com.opensymphony.xwork2.validator.validators

## Class FieldValidatorSupport

- java.lang.Object
- - com.opensymphony.xwork2.validator.validators.ValidatorSupport
  - - com.opensymphony.xwork2.validator.validators.FieldValidatorSupport

- All Implemented Interfaces:
    FieldValidator, ShortCircuitableValidator, Validator
  Direct Known Subclasses:
    DoubleRangeFieldValidator, FieldExpressionValidator, RangeValidatorSupport, RegexFieldValidator, RepopulateConversionErrorFieldValidatorSupport, RequiredFieldValidator, RequiredStringValidator, StringLengthFieldValidator, URLValidator, VisitorFieldValidator

      public abstract class FieldValidatorSupport
      extends ValidatorSupport
      implements FieldValidator

  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

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Object` | `currentValue`
    `protected String` | `fieldName`
    `protected String` | `type`

    - ### Fields inherited from class com.opensymphony.xwork2.validator.validators.ValidatorSupport

      `defaultMessage, EMPTY_STRING, messageKey, stack, textProviderFactory`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FieldValidatorSupport()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Object` | `getCurrentValue()`
    `String` | `getFieldName()` Gets the field name to be validated
    `String` | `getValidatorType()` Gets the validator type used (see class javadoc).
    `void` | `setFieldName(String fieldName)` Sets the field name to validate with this FieldValidator
    `void` | `setValidatorType(String type)` Sets the validator type to use (see class javadoc).

    - ### Methods inherited from class com.opensymphony.xwork2.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 com.opensymphony.xwork2.validator.Validator

      `getDefaultMessage, getMessage, getMessageKey, getMessageParameters, getValidatorContext, setDefaultMessage, setMessageKey, setMessageParameters, setValidatorContext, setValueStack, validate`

- - ### Field Detail

    - #### fieldName

          protected String fieldName

    - #### type

          protected String type

    - #### currentValue

          protected Object currentValue

  - ### Constructor Detail

    - #### FieldValidatorSupport

          public FieldValidatorSupport()

  - ### Method Detail

    - #### setFieldName

          public void setFieldName(String fieldName)

      Description copied from interface: `FieldValidator`
      Sets the field name to validate with this FieldValidator
      Specified by:
        `setFieldName` in interface `FieldValidator`
      Parameters:
        `fieldName` - the field name

    - #### getFieldName

          public String getFieldName()

      Description copied from interface: `FieldValidator`
      Gets the field name to be validated
      Specified by:
        `getFieldName` in interface `FieldValidator`
      Returns:
        the field name

    - #### setValidatorType

          public void setValidatorType(String type)

      Description copied from interface: `Validator`
      Sets the validator type to use (see class javadoc).
      Specified by:
        `setValidatorType` in interface `Validator`
      Overrides:
        `setValidatorType` in class `ValidatorSupport`
      Parameters:
        `type` - the type to use.

    - #### getValidatorType

          public String getValidatorType()

      Description copied from interface: `Validator`
      Gets the validator type used (see class javadoc).
      Specified by:
        `getValidatorType` in interface `Validator`
      Overrides:
        `getValidatorType` in class `ValidatorSupport`
      Returns:
        the type used

    - #### getCurrentValue

          public Object getCurrentValue()

Copyright © 2000–2020 Apache Software Foundation. All rights reserved.