javax.validation.Configuration.getDefaultMessageInterpolator()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(94)

本文整理了Java中javax.validation.Configuration.getDefaultMessageInterpolator()方法的一些代码示例,展示了Configuration.getDefaultMessageInterpolator()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.getDefaultMessageInterpolator()方法的具体详情如下:
包路径:javax.validation.Configuration
类名称:Configuration
方法名:getDefaultMessageInterpolator

Configuration.getDefaultMessageInterpolator介绍

[英]Returns an implementation of the MessageInterpolator interface following the default MessageInterpolator defined in the specification:

  • use the ValidationMessages resource bundle to load keys
  • use Locale.getDefault()
    [中]按照规范中定义的默认MessageInterpolator返回MessageInterpolator接口的实现:
    *使用ValidationMessages资源包加载密钥
    *使用区域设置。getDefault()

代码示例

代码示例来源:origin: org.springframework.boot/spring-boot

@Override
public MessageInterpolator getObject() throws BeansException {
  try {
    return Validation.byDefaultProvider().configure()
        .getDefaultMessageInterpolator();
  }
  catch (ValidationException ex) {
    MessageInterpolator fallback = getFallback();
    if (fallback != null) {
      return fallback;
    }
    throw ex;
  }
}

代码示例来源:origin: spring-projects/spring-framework

targetInterpolator = configuration.getDefaultMessageInterpolator();

代码示例来源:origin: org.springframework/spring-context

targetInterpolator = configuration.getDefaultMessageInterpolator();

代码示例来源:origin: hibernate/hibernate-validator

private MessageInterpolator createMessageInterpolator(Configuration<?> config) {
  BootstrapConfiguration bootstrapConfiguration = config.getBootstrapConfiguration();
  String messageInterpolatorFqcn = bootstrapConfiguration.getMessageInterpolatorClassName();
  if ( messageInterpolatorFqcn == null ) {
    return config.getDefaultMessageInterpolator();
  }
  @SuppressWarnings("unchecked")
  Class<? extends MessageInterpolator> messageInterpolatorClass = (Class<? extends MessageInterpolator>) run(
      LoadClass.action(
          messageInterpolatorFqcn,
          null
      )
  );
  return createInstance( messageInterpolatorClass );
}

代码示例来源:origin: org.apache.tomee/openejb-core

@Override
public MessageInterpolator getDefaultMessageInterpolator() {
  return delegate.getDefaultMessageInterpolator();
}

代码示例来源:origin: org.graniteds/granite-client-java-advanced

@Override
public MessageInterpolator getDefaultMessageInterpolator() {
  return configuration.getDefaultMessageInterpolator();
}

代码示例来源:origin: org.hibernate.jsr303.tck/jsr303-tck

public static MessageInterpolator getDefaultMessageInterpolator() {
  Configuration<?> config = getConfigurationUnderTest();
  return config.getDefaultMessageInterpolator();
}

代码示例来源:origin: org.hibernate.beanvalidation.tck/beanvalidation-tck-tests

public static MessageInterpolator getDefaultMessageInterpolator() {
  Configuration<?> config = getConfigurationUnderTest();
  return config.getDefaultMessageInterpolator();
}

代码示例来源:origin: org.apache.tapestry/tapestry-beanvalidator

@Override
  public void configure(javax.validation.Configuration<?> configuration)
  {
    MessageInterpolator defaultInterpolator = configuration.getDefaultMessageInterpolator();
    configuration.messageInterpolator(new MessageInterpolatorImpl(defaultInterpolator, threadLocale));
  }
});

代码示例来源:origin: com.googlecode.gwt-validation/gwt-validation

public void setConfiguration(Configuration<?> configuration) {
  if(configuration == null) return;
  this.configuration = configuration;
  this.resolver = this.configuration.getDefaultTraversableResolver();
  this.interpolator = this.configuration.getDefaultMessageInterpolator();
  this.constraintValidatorFactory = this.configuration.getDefaultConstraintValidatorFactory();
}

代码示例来源:origin: apache/tapestry-5

@Override
  public void configure(javax.validation.Configuration<?> configuration)
  {
    MessageInterpolator defaultInterpolator = configuration.getDefaultMessageInterpolator();
    configuration.messageInterpolator(new MessageInterpolatorImpl(defaultInterpolator, threadLocale));
  }
});

代码示例来源:origin: org.omnifaces/omnifaces

public JsfLabelMessageInterpolator() {
  wrapped = byDefaultProvider().configure().getDefaultMessageInterpolator();
}

代码示例来源:origin: omnifaces/omnifaces

public JsfLabelMessageInterpolator() {
  wrapped = byDefaultProvider().configure().getDefaultMessageInterpolator();
}

代码示例来源:origin: lutece-platform/lutece-core

/**
 * Constructor;
 */
public LuteceMessageInterpolator( )
{
  _interpolator = Validation.byDefaultProvider( ).configure( ).getDefaultMessageInterpolator( );
  _locale = LocaleService.getDefault( );
}

代码示例来源:origin: com.pojosontheweb/woko-hibernate

@Override
public void init(Configuration configuration) throws Exception {
  javax.validation.Configuration config = Validation.byDefaultProvider().configure();
  MessageInterpolator mi = new ClientLocaleMessageInterpolator(config.getDefaultMessageInterpolator());
  config = config.messageInterpolator( mi );
  VALIDATOR = config.buildValidatorFactory().getValidator();
}

代码示例来源:origin: apache/wicket

@Override
  public Validator get()
  {
    if (validator == null)
    {
      Configuration<?> config = Validation.byDefaultProvider().configure();

      MessageInterpolator interpolator = config.getDefaultMessageInterpolator();
      interpolator = new SessionLocaleInterpolator(interpolator);

      ValidatorFactory factory = config.messageInterpolator(interpolator)
        .buildValidatorFactory();

      validator = factory.getValidator();
    }
    return validator;
  }
}

代码示例来源:origin: org.wicketstuff/wicketstuff-jsr303

private synchronized ValidatorFactory createFactory()
{
  final Configuration<?> configuration = Validation.byDefaultProvider().configure();
  // FIXME seems like needed for hib-val 4.0.2.? strange enough it does
  // not respect the locale passed on interpolate call. Working on it.
  // geez. they screwed it up.
  // http://opensource.atlassian.com/projects/hibernate/browse/HV-306
  // fixed in 4.1.0.beta2 ... Locale.setDefault(Session.get().getLocale());
  final ValidatorFactory validationFactory = configuration.messageInterpolator(
    new WicketSessionLocaleMessageInterpolator(
      configuration.getDefaultMessageInterpolator())).buildValidatorFactory();
  return validationFactory;
}

代码示例来源:origin: org.wicketstuff/jsr303

private synchronized ValidatorFactory createFactory()
{
  final Configuration<?> configuration = Validation.byDefaultProvider().configure();
  // FIXME seems like needed for hib-val 4.0.2.? strange enough it does
  // not respect the locale passed on interpolate call. Working on it.
  // geez. they screwed it up.
  // http://opensource.atlassian.com/projects/hibernate/browse/HV-306
  // fixed in 4.1.0.beta2 ... Locale.setDefault(Session.get().getLocale());
  final ValidatorFactory validationFactory = configuration.messageInterpolator(
      new WicketSessionLocaleMessageInterpolator(configuration.getDefaultMessageInterpolator()))
      .buildValidatorFactory();
  return validationFactory;
}

代码示例来源:origin: actframework/actframework

private void init(App app) {
  config = Validation.byDefaultProvider().configure();
  config.messageInterpolator(new ActValidationMessageInterpolator(config.getDefaultMessageInterpolator(), app.config()));
  ensureFactoryValidator();
}

代码示例来源:origin: org.actframework/act

private void init(App app) {
  config = Validation.byDefaultProvider().configure();
  config.messageInterpolator(new ActValidationMessageInterpolator(config.getDefaultMessageInterpolator(), app.config()));
  ensureFactoryValidator();
}

相关文章