javax.validation.BootstrapConfiguration Java Examples

The following examples show how to use javax.validation.BootstrapConfiguration. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ValidatorContextResolver.java    From syndesis with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example #2
Source File: ValidationConfigurationContextResolver.java    From jaxrs-beanvalidation-javaee7 with Apache License 2.0 5 votes vote down vote up
/**
 * Get a context of type {@code GeneralValidator} that is applicable to the supplied type.
 *
 * @param type the class of object for which a context is desired
 * @return a context for the supplied type or {@code null} if a context for the supplied type is not available from
 *         this provider.
 */
@Override
public GeneralValidator getContext(Class<?> type) {
    Configuration<?> config = Validation.byDefaultProvider().configure();
    BootstrapConfiguration bootstrapConfiguration = config.getBootstrapConfiguration();

    config.messageInterpolator(new LocaleSpecificMessageInterpolator(Validation.byDefaultProvider().configure()
            .getDefaultMessageInterpolator()));
    config.parameterNameProvider(new CustomParameterNameProvider());

    return new GeneralValidatorImpl(config.buildValidatorFactory(),
            bootstrapConfiguration.isExecutableValidationEnabled(),
            bootstrapConfiguration.getDefaultValidatedExecutableTypes());
}
 
Example #3
Source File: ValidatorBuilder.java    From tomee with Apache License 2.0 4 votes vote down vote up
public OpenEjbConfig(final BootstrapConfiguration bootstrapConfig, final Configuration<T> target) {
    bootstrap = bootstrapConfig;
    delegate = target;
}
 
Example #4
Source File: ValidatorBuilder.java    From tomee with Apache License 2.0 4 votes vote down vote up
@Override
public BootstrapConfiguration getBootstrapConfiguration() {
    return bootstrap;
}