org.hibernate.validator
Interface HibernateValidatorConfiguration

All Superinterfaces:
javax.validation.Configuration<HibernateValidatorConfiguration>
All Known Implementing Classes:
ConfigurationImpl

public interface HibernateValidatorConfiguration
extends javax.validation.Configuration<HibernateValidatorConfiguration>

Uniquely identifies Hibernate Validator in the Bean Validation bootstrap strategy. Also contains Hibernate Validator specific configurations.

Author:
Emmanuel Bernard, Gunnar Morling

Method Summary
 HibernateValidatorConfiguration addMapping(ConstraintMapping mapping)
          Adds the specified ConstraintMapping instance to the configuration.
 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, getDefaultConstraintValidatorFactory, getDefaultMessageInterpolator, getDefaultTraversableResolver, ignoreXmlConfiguration, messageInterpolator, traversableResolver
 

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();
 <p/>
  ResourceBundleLocator defaultResourceBundleLocator =
    configure.getDefaultResourceBundleLocator();
  ResourceBundleLocator myResourceBundleLocator =
    new MyResourceBundleLocator(defaultResourceBundleLocator);
 <p/>
  configure.messageInterpolator(
    new ResourceBundleMessageInterpolator(myResourceBundleLocator));
 
 

Returns:
The default ResourceBundleLocator. Never null.

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


Copyright © 2011 Oracle Corporation. All Rights Reserved.