org.hibernate.validator

## Interface HibernateValidatorConfiguration

- All Superinterfaces:
    Configuration<HibernateValidatorConfiguration>
  All Known Implementing Classes:
    ConfigurationImpl

      public interface HibernateValidatorConfiguration
      extends Configuration<HibernateValidatorConfiguration>

  Uniquely identifies Hibernate Validator in the Bean Validation bootstrap strategy. Also contains Hibernate Validator specific configurations.
  Author:
    Emmanuel Bernard, Gunnar Morling, Kevin Pollet (C) 2011 SERLI, Hardy Ferentschik

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `FAIL_FAST` Property corresponding to the `failFast(boolean)` method.
    `static String` | `VALIDATED_VALUE_HANDLERS` Property corresponding to the `addValidatedValueHandler(ValidatedValueUnwrapper)` method.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `HibernateValidatorConfiguration` | `addMapping(ConstraintMapping mapping)` Adds the specified `ConstraintMapping` instance to the configuration.
    `HibernateValidatorConfiguration` | `addValidatedValueHandler(ValidatedValueUnwrapper<?> handler)` Registers the given validated value unwrapper with the bootstrapped validator factory.
    `ConstraintMapping` | `createConstraintMapping()` Creates a new constraint mapping which can be used to programmatically configure the constraints for given types.
    `HibernateValidatorConfiguration` | `failFast(boolean failFast)` En- or disables the fail fast mode.
    `ResourceBundleLocator` | `getDefaultResourceBundleLocator()` Returns the `ResourceBundleLocator` used by the `default message interpolator` to load user-provided resource bundles.

    - ### Methods inherited from interface javax.validation.Configuration

      `addMapping, addProperty, buildValidatorFactory, constraintValidatorFactory, getBootstrapConfiguration, getDefaultConstraintValidatorFactory, getDefaultMessageInterpolator, getDefaultParameterNameProvider, getDefaultTraversableResolver, ignoreXmlConfiguration, messageInterpolator, parameterNameProvider, traversableResolver`

- - ### Field Detail

    - #### FAIL_FAST

          static final String FAIL_FAST

      Property corresponding to the `failFast(boolean)` method. Accepts `true` or `false`. Defaults to `false`.
      See Also:
        Constant Field Values

    - #### VALIDATED_VALUE_HANDLERS

          static final String VALIDATED_VALUE_HANDLERS

      Property corresponding to the `addValidatedValueHandler(ValidatedValueUnwrapper)` method. Accepts a String with the comma-separated fully-qualified names of one or more `ValidatedValueUnwrapper` implementations.
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getDefaultResourceBundleLocator

          ResourceBundleLocator getDefaultResourceBundleLocator()

      Returns the `ResourceBundleLocator` used by the `default message interpolator` to load user-provided resource bundles. In conformance with the specification this default locator retrieves the bundle "ValidationMessages".

      This locator can be used as delegate for custom locators when setting a customized `ResourceBundleMessageInterpolator`:

           HibernateValidatorConfiguration configure =
              Validation.byProvider(HibernateValidator.class).configure();

            ResourceBundleLocator defaultResourceBundleLocator =
              configure.getDefaultBundleLocator();
            ResourceBundleLocator myResourceBundleLocator =
              new MyResourceBundleLocator(defaultResourceBundleLocator);

            configure.messageInterpolator(
              new ResourceBundleMessageInterpolator(myResourceBundleLocator));

      Returns:
        The default `ResourceBundleLocator`. Never null.

    - #### createConstraintMapping

          ConstraintMapping createConstraintMapping()

      Creates a new constraint mapping which can be used to programmatically configure the constraints for given types. After the mapping has been set up, it must be added to this configuration via `addMapping(ConstraintMapping)`.
      Returns:
        A new constraint mapping.

    - #### addMapping

          HibernateValidatorConfiguration addMapping(ConstraintMapping mapping)

      Adds the specified `ConstraintMapping` instance to the configuration. Constraints configured in `mapping` will be added to the constraints configured via annotations and/or xml.
      Parameters:
        `mapping` - `ConstraintMapping` instance containing programmatic configured constraints
      Returns:
        `this` following the chaining method pattern
      Throws:
        `IllegalArgumentException` - if `mapping` is `null`

    - #### failFast

          HibernateValidatorConfiguration failFast(boolean failFast)

      En- or disables the fail fast mode. When fail fast is enabled the validation will stop on the first constraint violation detected.
      Parameters:
        `failFast` - `true` to enable fail fast, `false` otherwise.
      Returns:
        `this` following the chaining method pattern

    - #### addValidatedValueHandler

          HibernateValidatorConfiguration addValidatedValueHandler(ValidatedValueUnwrapper<?> handler)

      Registers the given validated value unwrapper with the bootstrapped validator factory. When validating an element which is of a type supported by the unwrapper and which is annotated with `UnwrapValidatedValue`, the unwrapper will be applied to retrieve the value to validate.
      Parameters:
        `handler` - the unwrapper to register
      Returns:
        `this` following the chaining method pattern
      Experimental
        This API is considered experimental and may change in future revisions

Copyright © 2007-2014 Red Hat, Inc. All Rights Reserved