org.hibernate.validator.internal.engine

## Class ConfigurationImpl

- java.lang.Object
- - org.hibernate.validator.internal.engine.ConfigurationImpl

- All Implemented Interfaces:
    Configuration<HibernateValidatorConfiguration>, ConfigurationState, HibernateValidatorConfiguration

      public class ConfigurationImpl
      extends Object
      implements HibernateValidatorConfiguration, ConfigurationState

  Hibernate specific `Configuration` implementation.
  Author:
    Emmanuel Bernard, Hardy Ferentschik, Gunnar Morling, Kevin Pollet (C) 2011 SERLI

- - ### Field Summary

    - ### Fields inherited from interface org.hibernate.validator.HibernateValidatorConfiguration

      `FAIL_FAST, VALIDATED_VALUE_HANDLERS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ConfigurationImpl(BootstrapState state)`
    `ConfigurationImpl(ValidationProvider<?> provider)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `HibernateValidatorConfiguration` | `addMapping(ConstraintMapping mapping)` Adds the specified `ConstraintMapping` instance to the configuration.
    `HibernateValidatorConfiguration` | `addMapping(InputStream stream)`
    `HibernateValidatorConfiguration` | `addProperty(String name, String value)`
    `HibernateValidatorConfiguration` | `addValidatedValueHandler(ValidatedValueUnwrapper<?> handler)` Registers the given validated value unwrapper with the bootstrapped validator factory.
    `ValidatorFactory` | `buildValidatorFactory()`
    `ConfigurationImpl` | `constraintValidatorFactory(ConstraintValidatorFactory constraintValidatorFactory)`
    `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.
    `BootstrapConfiguration` | `getBootstrapConfiguration()`
    `ConstraintValidatorFactory` | `getConstraintValidatorFactory()`
    `ConstraintValidatorFactory` | `getDefaultConstraintValidatorFactory()`
    `MessageInterpolator` | `getDefaultMessageInterpolator()`
    `ParameterNameProvider` | `getDefaultParameterNameProvider()`
    `ResourceBundleLocator` | `getDefaultResourceBundleLocator()` Returns the `ResourceBundleLocator` used by the `default message interpolator` to load user-provided resource bundles.
    `TraversableResolver` | `getDefaultTraversableResolver()`
    `boolean` | `getFailFast()`
    `Set<InputStream>` | `getMappingStreams()`
    `MessageInterpolator` | `getMessageInterpolator()`
    `ParameterNameProvider` | `getParameterNameProvider()`
    `Set<DefaultConstraintMapping>` | `getProgrammaticMappings()`
    `Map<String,String>` | `getProperties()`
    `TraversableResolver` | `getTraversableResolver()`
    `List<ValidatedValueUnwrapper<?>>` | `getValidatedValueHandlers()`
    `HibernateValidatorConfiguration` | `ignoreXmlConfiguration()`
    `boolean` | `isIgnoreXmlConfiguration()`
    `ConfigurationImpl` | `messageInterpolator(MessageInterpolator interpolator)`
    `HibernateValidatorConfiguration` | `parameterNameProvider(ParameterNameProvider parameterNameProvider)`
    `ConfigurationImpl` | `traversableResolver(TraversableResolver resolver)`

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

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

- - ### Constructor Detail

    - #### ConfigurationImpl

          public ConfigurationImpl(BootstrapState state)

    - #### ConfigurationImpl

          public ConfigurationImpl(ValidationProvider<?> provider)

  - ### Method Detail

    - #### ignoreXmlConfiguration

          public final HibernateValidatorConfiguration ignoreXmlConfiguration()

      Specified by:
        `ignoreXmlConfiguration` in interface `Configuration<HibernateValidatorConfiguration>`

    - #### messageInterpolator

          public final ConfigurationImpl messageInterpolator(MessageInterpolator interpolator)

      Specified by:
        `messageInterpolator` in interface `Configuration<HibernateValidatorConfiguration>`

    - #### traversableResolver

          public final ConfigurationImpl traversableResolver(TraversableResolver resolver)

      Specified by:
        `traversableResolver` in interface `Configuration<HibernateValidatorConfiguration>`

    - #### constraintValidatorFactory

          public final ConfigurationImpl constraintValidatorFactory(ConstraintValidatorFactory constraintValidatorFactory)

      Specified by:
        `constraintValidatorFactory` in interface `Configuration<HibernateValidatorConfiguration>`

    - #### parameterNameProvider

          public HibernateValidatorConfiguration parameterNameProvider(ParameterNameProvider parameterNameProvider)

      Specified by:
        `parameterNameProvider` in interface `Configuration<HibernateValidatorConfiguration>`

    - #### addMapping

          public final HibernateValidatorConfiguration addMapping(InputStream stream)

      Specified by:
        `addMapping` in interface `Configuration<HibernateValidatorConfiguration>`

    - #### failFast

          public final HibernateValidatorConfiguration failFast(boolean failFast)

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

    - #### createConstraintMapping

          public final ConstraintMapping createConstraintMapping()

      Description copied from interface: `HibernateValidatorConfiguration`
      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 `HibernateValidatorConfiguration.addMapping(ConstraintMapping)`.
      Specified by:
        `createConstraintMapping` in interface `HibernateValidatorConfiguration`
      Returns:
        A new constraint mapping.

    - #### addMapping

          public final HibernateValidatorConfiguration addMapping(ConstraintMapping mapping)

      Description copied from interface: `HibernateValidatorConfiguration`
      Adds the specified `ConstraintMapping` instance to the configuration. Constraints configured in `mapping` will be added to the constraints configured via annotations and/or xml.
      Specified by:
        `addMapping` in interface `HibernateValidatorConfiguration`
      Parameters:
        `mapping` - `ConstraintMapping` instance containing programmatic configured constraints
      Returns:
        `this` following the chaining method pattern

    - #### addProperty

          public final HibernateValidatorConfiguration addProperty(String name,
                                                    String value)

      Specified by:
        `addProperty` in interface `Configuration<HibernateValidatorConfiguration>`

    - #### addValidatedValueHandler

          public HibernateValidatorConfiguration addValidatedValueHandler(ValidatedValueUnwrapper<?> handler)

      Description copied from interface: `HibernateValidatorConfiguration`
      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.
      Specified by:
        `addValidatedValueHandler` in interface `HibernateValidatorConfiguration`
      Parameters:
        `handler` - the unwrapper to register
      Returns:
        `this` following the chaining method pattern

    - #### buildValidatorFactory

          public final ValidatorFactory buildValidatorFactory()

      Specified by:
        `buildValidatorFactory` in interface `Configuration<HibernateValidatorConfiguration>`

    - #### isIgnoreXmlConfiguration

          public final boolean isIgnoreXmlConfiguration()

      Specified by:
        `isIgnoreXmlConfiguration` in interface `ConfigurationState`

    - #### getMessageInterpolator

          public final MessageInterpolator getMessageInterpolator()

      Specified by:
        `getMessageInterpolator` in interface `ConfigurationState`

    - #### getMappingStreams

          public final Set<InputStream> getMappingStreams()

      Specified by:
        `getMappingStreams` in interface `ConfigurationState`

    - #### getFailFast

          public final boolean getFailFast()

    - #### getConstraintValidatorFactory

          public final ConstraintValidatorFactory getConstraintValidatorFactory()

      Specified by:
        `getConstraintValidatorFactory` in interface `ConfigurationState`

    - #### getTraversableResolver

          public final TraversableResolver getTraversableResolver()

      Specified by:
        `getTraversableResolver` in interface `ConfigurationState`

    - #### getBootstrapConfiguration

          public BootstrapConfiguration getBootstrapConfiguration()

      Specified by:
        `getBootstrapConfiguration` in interface `Configuration<HibernateValidatorConfiguration>`

    - #### getParameterNameProvider

          public ParameterNameProvider getParameterNameProvider()

      Specified by:
        `getParameterNameProvider` in interface `ConfigurationState`

    - #### getValidatedValueHandlers

          public List<ValidatedValueUnwrapper<?>> getValidatedValueHandlers()

    - #### getProperties

          public final Map<String,String> getProperties()

      Specified by:
        `getProperties` in interface `ConfigurationState`

    - #### getDefaultMessageInterpolator

          public final MessageInterpolator getDefaultMessageInterpolator()

      Specified by:
        `getDefaultMessageInterpolator` in interface `Configuration<HibernateValidatorConfiguration>`

    - #### getDefaultTraversableResolver

          public final TraversableResolver getDefaultTraversableResolver()

      Specified by:
        `getDefaultTraversableResolver` in interface `Configuration<HibernateValidatorConfiguration>`

    - #### getDefaultConstraintValidatorFactory

          public final ConstraintValidatorFactory getDefaultConstraintValidatorFactory()

      Specified by:
        `getDefaultConstraintValidatorFactory` in interface `Configuration<HibernateValidatorConfiguration>`

    - #### getDefaultResourceBundleLocator

          public final ResourceBundleLocator getDefaultResourceBundleLocator()

      Description copied from interface: `HibernateValidatorConfiguration`

      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));

      Specified by:
        `getDefaultResourceBundleLocator` in interface `HibernateValidatorConfiguration`
      Returns:
        The default `ResourceBundleLocator`. Never null.

    - #### getDefaultParameterNameProvider

          public ParameterNameProvider getDefaultParameterNameProvider()

      Specified by:
        `getDefaultParameterNameProvider` in interface `Configuration<HibernateValidatorConfiguration>`

    - #### getProgrammaticMappings

          public final Set<DefaultConstraintMapping> getProgrammaticMappings()

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