Examples of messageInterpolator()


Examples of javax.validation.Configuration.messageInterpolator()

  @Test
  @SpecAssertion(section = "4.3.2", id = "b")
  public void testCustomMessageInterpolatorViaConfiguration() {
    Configuration config = Validation.byDefaultProvider().configure();
    config = config.messageInterpolator( new DummyMessageInterpolator() );
    Validator validator = config.buildValidatorFactory().getValidator();

    assertCustomMessageInterpolatorUsed( validator );
  }
View Full Code Here

Examples of javax.validation.ValidatorContext.messageInterpolator()

    }

    ValidatorContext validatorContext = validatorFactory.usingContext();
    MessageInterpolator jsfMessageInterpolator = new JsfMessageInterpolator(
        locale, validatorFactory.getMessageInterpolator());
    validatorContext.messageInterpolator(jsfMessageInterpolator);
    Validator beanValidator = validatorContext.getValidator();
    return beanValidator;
  }

  private static class JsfMessageInterpolator implements MessageInterpolator {
View Full Code Here

Examples of javax.validation.ValidatorContext.messageInterpolator()

    ValidatorContext validatorContext = this.validatorFactory.usingContext();
    MessageInterpolator targetInterpolator = this.messageInterpolator;
    if (targetInterpolator == null) {
      targetInterpolator = this.validatorFactory.getMessageInterpolator();
    }
    validatorContext.messageInterpolator(new LocaleContextMessageInterpolator(targetInterpolator));
    if (this.traversableResolver != null) {
      validatorContext.traversableResolver(this.traversableResolver);
    }

    setTargetValidator(validatorContext.getValidator());
View Full Code Here

Examples of javax.validation.ValidatorContext.messageInterpolator()

        });
        try {
            Thread.currentThread().setContextClassLoader(null);
            ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory();
            ValidatorContext validatorContext = validatorFactory.usingContext();
            validatorContext.messageInterpolator(new MessageInterpolatorImpl());
            beanValidator = validatorContext.getValidator();
        } finally {
            Thread.currentThread().setContextClassLoader(cl);
        }
    }
View Full Code Here

Examples of javax.validation.ValidatorContext.messageInterpolator()

        ValidatorContext validatorContext = validatorFactory.usingContext();
        MessageInterpolator jsfMessageInterpolator =
                new JsfAwareMessageInterpolator(context,
                           validatorFactory.getMessageInterpolator());
        validatorContext.messageInterpolator(jsfMessageInterpolator);
        javax.validation.Validator beanValidator = validatorContext.getValidator();
        Class[] validationGroupsArray = parseValidationGroups(getValidationGroups());
       
        // PENDING(rlubke, driscoll): When EL 1.3 is present, we won't need
        // this.
View Full Code Here

Examples of javax.validation.ValidatorContext.messageInterpolator()

        });
        try {
            Thread.currentThread().setContextClassLoader(Validation.class.getClassLoader());
            ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory();
            ValidatorContext validatorContext = validatorFactory.usingContext();
            validatorContext.messageInterpolator(new MessageInterpolatorImpl());
            beanValidator = validatorContext.getValidator();
        } finally {
            Thread.currentThread().setContextClassLoader(cl);
        }
    }
View Full Code Here

Examples of javax.validation.ValidatorContext.messageInterpolator()

                        }
                    };

                ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory();
                ValidatorContext validatorContext = validatorFactory.usingContext();
                validatorContext.messageInterpolator(new MessageInterpolatorImpl());               
                    beanValidator = validatorContext.traversableResolver(
                            traversableResolver).getValidator();
            } finally {
                Thread.currentThread().setContextClassLoader(cl);
            }
View Full Code Here

Examples of javax.validation.ValidatorContext.messageInterpolator()

        });
        try {
            Thread.currentThread().setContextClassLoader(null);
            ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory();
            ValidatorContext validatorContext = validatorFactory.usingContext();
            validatorContext.messageInterpolator(new MessageInterpolatorImpl());
            beanValidator = validatorContext.getValidator();
        } finally {
            Thread.currentThread().setContextClassLoader(cl);
        }
    }
View Full Code Here

Examples of javax.validation.ValidatorContext.messageInterpolator()

        ValidatorContext validatorContext = validatorFactory.usingContext();
        MessageInterpolator jsfMessageInterpolator =
                new JsfAwareMessageInterpolator(context,
                           validatorFactory.getMessageInterpolator());
        validatorContext.messageInterpolator(jsfMessageInterpolator);
        javax.validation.Validator beanValidator = validatorContext.getValidator();
        Class[] validationGroupsArray = parseValidationGroups(getValidationGroups());
       
        // PENDING(rlubke, driscoll): When EL 1.3 is present, we won't need
        // this.
View Full Code Here

Examples of javax.validation.ValidatorContext.messageInterpolator()

                    final ValidationConfig config = contextResolver.getContext(ValidationConfig.class);

                    if (config != null) {
                        // MessageInterpolator
                        if (config.getMessageInterpolator() != null) {
                            context.messageInterpolator(config.getMessageInterpolator());
                        }

                        // TraversableResolver
                        if (config.getTraversableResolver() != null) {
                            context.traversableResolver(
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.