org.jboss.resteasy.spi.validation.GeneralValidator Java Examples

The following examples show how to use org.jboss.resteasy.spi.validation.GeneralValidator. 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: KrazoGeneralValidator.java    From krazo with Apache License 2.0 4 votes vote down vote up
KrazoGeneralValidator(GeneralValidator delegate) {
    this.delegate = delegate;
}
 
Example #4
Source File: OzarkGeneralValidator.java    From ozark with Apache License 2.0 4 votes vote down vote up
OzarkGeneralValidator(GeneralValidator delegate) {
    this.delegate = delegate;
}
 
Example #5
Source File: KrazoValidationResolver.java    From krazo with Apache License 2.0 3 votes vote down vote up
public GeneralValidator getContext(Class<?> aClass) {

        // get the real RESTEasy validator
        GeneralValidator wrapped = new ValidatorContextResolver().getContext(aClass);

        // only delegate to wrapped validator for regular JAX-RS requests
        return new KrazoGeneralValidator(wrapped);

    }
 
Example #6
Source File: OzarkValidationResolver.java    From ozark with Apache License 2.0 3 votes vote down vote up
public GeneralValidator getContext(Class<?> aClass) {

        // get the real RESTEasy validator
        GeneralValidator wrapped = new ValidatorContextResolver().getContext(aClass);

        // only delegate to wrapped validator for regular JAX-RS requests
        return new OzarkGeneralValidator(wrapped);

    }