Search in sources :

Example 6 with ValidatorContext

use of jakarta.validation.ValidatorContext in project mojarra by eclipse-ee4j.

the class BeanValidator method getBeanValidator.

// ----------------------------------------------------- Private helper methods for bean validation
// MOJARRA IMPLEMENTATION NOTE: identical code exists in Mojarra's com.sun.faces.util.BeanValidation
private static jakarta.validation.Validator getBeanValidator(FacesContext context) {
    ValidatorFactory validatorFactory = getValidatorFactory(context);
    ValidatorContext validatorContext = validatorFactory.usingContext();
    MessageInterpolator facesMessageInterpolator = new FacesAwareMessageInterpolator(context, validatorFactory.getMessageInterpolator());
    validatorContext.messageInterpolator(facesMessageInterpolator);
    return validatorContext.getValidator();
}
Also used : ValidatorFactory(jakarta.validation.ValidatorFactory) ValidatorContext(jakarta.validation.ValidatorContext) MessageInterpolator(jakarta.validation.MessageInterpolator)

Aggregations

ValidatorContext (jakarta.validation.ValidatorContext)6 MessageInterpolator (jakarta.validation.MessageInterpolator)5 ValidatorFactory (jakarta.validation.ValidatorFactory)3 Validation.buildDefaultValidatorFactory (jakarta.validation.Validation.buildDefaultValidatorFactory)1 MessageInterpolatorImpl (org.glassfish.hk2.utilities.general.internal.MessageInterpolatorImpl)1 HibernateValidator (org.hibernate.validator.HibernateValidator)1