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

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

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

Configuration.getDefaultTraversableResolver介绍

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

  • if Java Persistence is available in the runtime environment, a property is considered reachable if Java Persistence considers the property as loaded
  • if Java Persistence is not available in the runtime environment, all properties are considered reachable
  • all properties are considered cascadable.
    [中]返回规范中定义的默认TraversableResolver之后的TraversableResolver接口的实现:
    *如果Java持久性在运行时环境中可用,则如果Java持久性认为某个属性已加载,则认为该属性是可访问的
    *如果Java持久性在运行时环境中不可用,则认为所有属性都是可访问的
    *所有属性都被认为是可级联的。

代码示例

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

/**
 * Create traversable resolver able to process {@link javax.validation.executable.ValidateOnExecution} annotation on
 * beans.
 *
 * @param delegate resolver to be wrapped into the custom traversable resolver.
 * @param handler  handler to create traversable resolver for.
 * @return custom traversable resolver.
 */
private ValidateOnExecutionTraversableResolver getTraversableResolver(TraversableResolver delegate,
                                   final ValidateOnExecutionHandler handler) {
  if (delegate == null) {
    delegate = validationConfig.getDefaultTraversableResolver();
  }
  final boolean validationEnabled = validationConfig.getBootstrapConfiguration().isExecutableValidationEnabled();
  final ValidateOnExecutionTraversableResolver traversableResolver = new
      ValidateOnExecutionTraversableResolver(delegate, handler, validationEnabled);
  return resourceContext.initResource(traversableResolver);
}

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

private TraversableResolver createTraversableResolver(Configuration<?> config) {
  BootstrapConfiguration bootstrapConfiguration = config.getBootstrapConfiguration();
  String traversableResolverFqcn = bootstrapConfiguration.getTraversableResolverClassName();
  if ( traversableResolverFqcn == null ) {
    return config.getDefaultTraversableResolver();
  }
  @SuppressWarnings("unchecked")
  Class<? extends TraversableResolver> traversableResolverClass = (Class<? extends TraversableResolver>) run(
      LoadClass.action(
          traversableResolverFqcn,
          null
      )
  );
  return createInstance( traversableResolverClass );
}

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

@Override
public TraversableResolver getDefaultTraversableResolver() {
  return delegate.getDefaultTraversableResolver();
}

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

@Override
public TraversableResolver getDefaultTraversableResolver() {
  return configuration.getDefaultTraversableResolver();
}

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

@Test
@SpecAssertion(section = Sections.VALIDATIONAPI_BOOTSTRAPPING_CONFIGURATION, id = "b")
public void testDefaultTraversableResolverIsNotNull() {
  Configuration<?> config = TestUtil.getConfigurationUnderTest();
  assertNotNull( config.getDefaultTraversableResolver() );
}

代码示例来源: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: org.glassfish.jersey.ext/jersey-bean-validation

/**
 * Create traversable resolver able to process {@link javax.validation.executable.ValidateOnExecution} annotation on
 * beans.
 *
 * @param delegate resolver to be wrapped into the custom traversable resolver.
 * @param handler  handler to create traversable resolver for.
 * @return custom traversable resolver.
 */
private ValidateOnExecutionTraversableResolver getTraversableResolver(TraversableResolver delegate,
                                   final ValidateOnExecutionHandler handler) {
  if (delegate == null) {
    delegate = validationConfig.getDefaultTraversableResolver();
  }
  final boolean validationEnabled = validationConfig.getBootstrapConfiguration().isExecutableValidationEnabled();
  final ValidateOnExecutionTraversableResolver traversableResolver = new
      ValidateOnExecutionTraversableResolver(delegate, handler, validationEnabled);
  return resourceContext.initResource(traversableResolver);
}

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

private TraversableResolver createTraversableResolver(Configuration<?> config) {
  BootstrapConfiguration bootstrapConfiguration = config.getBootstrapConfiguration();
  String traversableResolverFqcn = bootstrapConfiguration.getTraversableResolverClassName();
  if ( traversableResolverFqcn == null ) {
    return config.getDefaultTraversableResolver();
  }
  @SuppressWarnings("unchecked")
  Class<? extends TraversableResolver> traversableResolverClass = (Class<? extends TraversableResolver>) run(
      LoadClass.action(
          traversableResolverFqcn,
          null
      )
  );
  return createInstance( traversableResolverClass );
}

相关文章