Package org.apache.struts2.validator

# Class DefaultValidatorFactory

java.lang.Object
org.apache.struts2.validator.DefaultValidatorFactory

All Implemented Interfaces:
  `Initializable`, `ValidatorFactory`

public class DefaultValidatorFactory extends Object implements ValidatorFactory, Initializable
Default validator factory

Version:
  $Date$ $Id$
Author:
  Jason Carreira, James House

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected ObjectFactory`
  `objectFactory`
  `protected ValidatorFileParser`
  `validatorFileParser`
  `protected Map<String,String>`
  `validators`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DefaultValidatorFactory(ObjectFactory objectFactory, ValidatorFileParser parser)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Validator`
  `getValidator(ValidatorConfig cfg)`
  Get a Validator that matches the given configuration.
  `void`
  `init()`
  Use this method to initialise your bean, the whole dependency graph was already built
  `String`
  `lookupRegisteredValidatorType(String name)`
  Lookup to get the FQ classname of the given validator name.
  `void`
  `registerValidator(String name, String className)`
  Registers the given validator to the existing map of validators.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### validators

    protected Map<String,String> validators

  - ### objectFactory

    protected ObjectFactory objectFactory

  - ### validatorFileParser

    protected ValidatorFileParser validatorFileParser

- ## Constructor Details

  - ### DefaultValidatorFactory

    public DefaultValidatorFactory(ObjectFactory objectFactory, ValidatorFileParser parser)

- ## Method Details

  - ### init

    public void init()
    Description copied from interface: `Initializable`
    Use this method to initialise your bean, the whole dependency graph was already built
    Specified by:
      `init` in interface `Initializable`

  - ### getValidator

    public Validator getValidator(ValidatorConfig cfg)
    Description copied from interface: `ValidatorFactory`
    Get a Validator that matches the given configuration.
    Specified by:
      `getValidator` in interface `ValidatorFactory`
    Parameters:
      `cfg` - the configurator.
    Returns:
      the validator.

  - ### registerValidator

    public void registerValidator(String name, String className)
    Description copied from interface: `ValidatorFactory`
    Registers the given validator to the existing map of validators. This will add to the existing list.
    Specified by:
      `registerValidator` in interface `ValidatorFactory`
    Parameters:
      `name` - name of validator to add.
      `className` - the FQ classname of the validator.

  - ### lookupRegisteredValidatorType

    public String lookupRegisteredValidatorType(String name)
    Description copied from interface: `ValidatorFactory`
    Lookup to get the FQ classname of the given validator name.
    Specified by:
      `lookupRegisteredValidatorType` in interface `ValidatorFactory`
    Parameters:
      `name` - name of validator to lookup.
    Returns:
      the found FQ classname