Search in sources :

Example 1 with ResourceBundleLocator

use of org.hibernate.validator.spi.resourceloading.ResourceBundleLocator in project syndesis by syndesisio.

the class ValidatorContextResolver method getContext.

@Override
public GeneralValidator getContext(final Class<?> type) {
    final ResourceBundleLocator resourceBundleLocator = new PlatformResourceBundleLocator("messages");
    final MessageInterpolator messageInterpolator = new ResourceBundleMessageInterpolator(resourceBundleLocator);
    final Configuration<?> config = Validation.byDefaultProvider().configure().messageInterpolator(messageInterpolator);
    final BootstrapConfiguration bootstrapConfiguration = config.getBootstrapConfiguration();
    final boolean isExecutableValidationEnabled = bootstrapConfiguration.isExecutableValidationEnabled();
    final Set<ExecutableType> defaultValidatedExecutableTypes = bootstrapConfiguration.getDefaultValidatedExecutableTypes();
    return new GeneralValidatorImpl(validatorFactory, isExecutableValidationEnabled, defaultValidatedExecutableTypes);
}
Also used : ExecutableType(javax.validation.executable.ExecutableType) ResourceBundleMessageInterpolator(org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator) GeneralValidatorImpl(org.jboss.resteasy.plugins.validation.GeneralValidatorImpl) PlatformResourceBundleLocator(org.hibernate.validator.resourceloading.PlatformResourceBundleLocator) BootstrapConfiguration(javax.validation.BootstrapConfiguration) ResourceBundleLocator(org.hibernate.validator.spi.resourceloading.ResourceBundleLocator) PlatformResourceBundleLocator(org.hibernate.validator.resourceloading.PlatformResourceBundleLocator) ResourceBundleMessageInterpolator(org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator) MessageInterpolator(javax.validation.MessageInterpolator)

Aggregations

BootstrapConfiguration (javax.validation.BootstrapConfiguration)1 MessageInterpolator (javax.validation.MessageInterpolator)1 ExecutableType (javax.validation.executable.ExecutableType)1 ResourceBundleMessageInterpolator (org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator)1 PlatformResourceBundleLocator (org.hibernate.validator.resourceloading.PlatformResourceBundleLocator)1 ResourceBundleLocator (org.hibernate.validator.spi.resourceloading.ResourceBundleLocator)1 GeneralValidatorImpl (org.jboss.resteasy.plugins.validation.GeneralValidatorImpl)1