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

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

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

Configuration.getDefaultClockProvider介绍

[英]Returns an implementation of the ClockProviderinterface following the default ClockProviderdefined in the specification:

  • returns a clock representing the current system time and default time zone.
    [中]

代码示例

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

private ClockProvider createClockProvider(Configuration<?> config) {
  BootstrapConfiguration bootstrapConfiguration = config.getBootstrapConfiguration();
  String clockProviderFqcn = bootstrapConfiguration.getClockProviderClassName();
  if ( clockProviderFqcn == null ) {
    return config.getDefaultClockProvider();
  }
  @SuppressWarnings("unchecked")
  Class<? extends ClockProvider> clockProviderClass = (Class<? extends ClockProvider>) run(
      LoadClass.action(
          clockProviderFqcn,
          null
      )
  );
  return createInstance( clockProviderClass );
}

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

@Test
@SpecAssertion(section = Sections.VALIDATIONAPI_BOOTSTRAPPING_CONFIGURATION, id = "e")
public void testDefaultClockProviderProvidedByConfiguration() {
  Configuration<?> config = TestUtil.getConfigurationUnderTest();
  assertNotNull( config.getDefaultClockProvider() );
  checkClockProviderHasDefaultProperties( config.getDefaultClockProvider() );
}

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

private ClockProvider createClockProvider(Configuration<?> config) {
  BootstrapConfiguration bootstrapConfiguration = config.getBootstrapConfiguration();
  String clockProviderFqcn = bootstrapConfiguration.getClockProviderClassName();
  if ( clockProviderFqcn == null ) {
    return config.getDefaultClockProvider();
  }
  @SuppressWarnings("unchecked")
  Class<? extends ClockProvider> clockProviderClass = (Class<? extends ClockProvider>) run(
      LoadClass.action(
          clockProviderFqcn,
          null
      )
  );
  return createInstance( clockProviderClass );
}

相关文章