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

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

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

Configuration.ignoreXmlConfiguration介绍

[英]Ignores data from the META-INF/validation.xml file if this method is called.

This method is typically useful for containers that parse META-INF/validation.xml themselves and pass the information via the Configuration methods.
[中]忽略META-INF/验证中的数据。如果调用此方法,则返回xml文件。
此方法通常适用于解析META-INF/验证的容器。xml本身,并通过配置方法传递信息。

代码示例

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

@SuppressWarnings("unchecked")
@Override
public T ignoreXmlConfiguration() {
  configuration = configuration.ignoreXmlConfiguration();
  return (T)this;
}

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

@Override
public T ignoreXmlConfiguration() {
  return delegate.ignoreXmlConfiguration();
}

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

@Override
  public void configure(javax.validation.Configuration<?> configuration)
  {
    configuration.ignoreXmlConfiguration();
  }
});

代码示例来源:origin: io.micronaut.configuration/micronaut-hibernate-validator

validatorConfiguration.ignoreXmlConfiguration();

代码示例来源:origin: torakiki/sejda

private DefaultValidationContext() {
  Configuration<?> validationConfig = Validation.byDefaultProvider().configure();
  if (new DefaultSejdaContext().isIgnoreXmlConfiguration()) {
    validationConfig.ignoreXmlConfiguration();
  }
  ValidatorFactory factory = validationConfig.buildValidatorFactory();
  validator = factory.getValidator();
}

代码示例来源:origin: Cognifide/aet

private static void initGenerator() {
 validator = Validation.byDefaultProvider()
   .providerResolver(new HibernateValidationProviderResolver())
   .configure().ignoreXmlConfiguration()
   .buildValidatorFactory()
   .getValidator();
}

代码示例来源:origin: org.sejda/sejda-core

private DefaultValidationContext() {
  Configuration<?> validationConfig = Validation.byDefaultProvider().configure();
  if (new DefaultSejdaContext().isIgnoreXmlConfiguration()) {
    validationConfig.ignoreXmlConfiguration();
  }
  ValidatorFactory factory = validationConfig.buildValidatorFactory();
  validator = factory.getValidator();
}

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

@Test
  @SpecAssertion(section = "7.1.1", id = "d")
  public void testConstraintAnnotationsArePerDefaultIgnoredForXmlConfiguredEntities() {
    Validator validator = TestUtil.getValidatorUnderTest();
    BeanDescriptor beanDescriptor = validator.getConstraintsForClass( Package.class );
    assertFalse( beanDescriptor.isBeanConstrained(), "With xml configuration there should be no constraint." );

    Configuration<?> config = TestUtil.getConfigurationUnderTest();
    config.ignoreXmlConfiguration();
    validator = config.buildValidatorFactory().getValidator();
    beanDescriptor = validator.getConstraintsForClass( Package.class );
    assertTrue(
        beanDescriptor.isBeanConstrained(),
        "If xml configuration is ignored Package should have a single constraint."
    );
  }
}

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

@Test
  @SpecAssertion(section = Sections.XML_MAPPING_CONSTRAINTDECLARATIONINXML, id = "d")
  public void testConstraintAnnotationsArePerDefaultIgnoredForXmlConfiguredEntities() {
    Validator validator = TestUtil.getValidatorUnderTest();
    BeanDescriptor beanDescriptor = validator.getConstraintsForClass( Package.class );
    assertFalse( beanDescriptor.isBeanConstrained(), "With xml configuration there should be no constraint." );

    Configuration<?> config = TestUtil.getConfigurationUnderTest();
    config.ignoreXmlConfiguration();
    validator = config.buildValidatorFactory().getValidator();
    beanDescriptor = validator.getConstraintsForClass( Package.class );
    assertTrue(
        beanDescriptor.isBeanConstrained(),
        "If xml configuration is ignored Package should have a single constraint."
    );
  }
}

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

@Test
@SpecAssertion(section = Sections.XML_MAPPING_CONSTRAINTDECLARATIONINXML, id = "e")
@SpecAssertion(section = Sections.XML_MAPPING_CONSTRAINTDECLARATIONINXML, id = "a")
public void testEntityConfiguredViaAnnotationsAndXml() {
  Validator validator = TestUtil.getValidatorUnderTest();
  BeanDescriptor beanDescriptor = validator.getConstraintsForClass( Package.class );
  assertTrue( beanDescriptor.isBeanConstrained(), "The bean should be constrained" );
  assertEquals(
      beanDescriptor.getConstraintsForProperty( "maxWeight" ).getConstraintDescriptors().size(),
      2,
      "With xml configuration there should be two constraints."
  );
  Configuration<?> config = TestUtil.getConfigurationUnderTest();
  config.ignoreXmlConfiguration();
  validator = config.buildValidatorFactory().getValidator();
  beanDescriptor = validator.getConstraintsForClass( Package.class );
  assertTrue(
      beanDescriptor.isBeanConstrained(),
      "Without xml there should be only one constraint."
  );
  assertEquals(
      beanDescriptor.getConstraintsForProperty( "maxWeight" ).getConstraintDescriptors().size(),
      1,
      "Without xml there should be only one constraint."
  );
}

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

@Test
@SpecAssertions({
    @SpecAssertion(section = "7.1.1", id = "e"),
    @SpecAssertion(section = "7.1.1", id = "a")
}
)
public void testEntityConfiguredViaAnnotationsAndXml() {
  Validator validator = TestUtil.getValidatorUnderTest();
  BeanDescriptor beanDescriptor = validator.getConstraintsForClass( Package.class );
  assertTrue( beanDescriptor.isBeanConstrained(), "The bean should be constrained" );
  assertEquals(
      beanDescriptor.getConstraintsForProperty( "maxWeight" ).getConstraintDescriptors().size(),
      2,
      "With xml configuration there should be two constraints."
  );
  Configuration<?> config = TestUtil.getConfigurationUnderTest();
  config.ignoreXmlConfiguration();
  validator = config.buildValidatorFactory().getValidator();
  beanDescriptor = validator.getConstraintsForClass( Package.class );
  assertTrue(
      beanDescriptor.isBeanConstrained(),
      "Without xml there should be only one constraint."
  );
  assertEquals(
      beanDescriptor.getConstraintsForProperty( "maxWeight" ).getConstraintDescriptors().size(),
      1,
      "Without xml there should be only one constraint."
  );
}

代码示例来源:origin: torakiki/sejda

private ValidatorHolder() {
  Configuration<?> validationConfig = Validation.byDefaultProvider().configure();
  validationConfig.ignoreXmlConfiguration();
  ValidatorFactory factory = validationConfig.buildValidatorFactory();
  validator = factory.getValidator();
}

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

@Test
@SpecAssertions({
    @SpecAssertion(section = "4.4.6", id = "b"),
    @SpecAssertion(section = "4.4.6", id = "l"),
    @SpecAssertion(section = "4.4.6", id = "k"),
    @SpecAssertion(section = "7.1.1", id = "a"),
    @SpecAssertion(section = "7.1.1", id = "b"),
    @SpecAssertion(section = "7.1.2", id = "a")
})
public void testIgnoreValidationXml() {
  Configuration<?> config = TestUtil.getConfigurationUnderTest();
  Validator validator = config.ignoreXmlConfiguration().buildValidatorFactory().getValidator();
  Order order = new Order();
  Set<ConstraintViolation<Order>> constraintViolations = validator.validate( order );
  assertCorrectNumberOfViolations( constraintViolations, 0 );
}

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

@Test
@SpecAssertions({
    @SpecAssertion(section = Sections.VALIDATIONAPI_BOOTSTRAPPING_XMLCONFIGURATION, id = "a"),
    @SpecAssertion(section = Sections.VALIDATIONAPI_BOOTSTRAPPING_XMLCONFIGURATION, id = "r"),
    @SpecAssertion(section = Sections.VALIDATIONAPI_BOOTSTRAPPING_XMLCONFIGURATION, id = "s"),
    @SpecAssertion(section = Sections.XML_MAPPING_CONSTRAINTDECLARATIONINXML, id = "a"),
    @SpecAssertion(section = Sections.XML_MAPPING_CONSTRAINTDECLARATIONINXML, id = "b"),
    @SpecAssertion(section = Sections.XML_MAPPING_CONSTRAINTDEFINITION, id = "a")
})
public void testIgnoreValidationXml() {
  Configuration<?> config = TestUtil.getConfigurationUnderTest();
  Validator validator = config.ignoreXmlConfiguration().buildValidatorFactory().getValidator();
  Order order = new Order();
  Set<ConstraintViolation<Order>> constraintViolations = getValidator().validate( order );
  assertNumberOfViolations( constraintViolations, 0 );
}

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

target.ignoreXmlConfiguration();

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

final OpenEjbConfig config = new OpenEjbConfig(bootstrapConfig, target);
target.ignoreXmlConfiguration();

相关文章