javax.validation.constraints.NotNull.groups()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(3.2k)|赞(0)|评价(0)|浏览(453)

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

NotNull.groups介绍

暂无

代码示例

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

@Test
@SpecAssertion(section = Sections.CONSTRAINTSDEFINITIONIMPLEMENTATION_CONSTRAINTCOMPOSITION, id = "d")
@SpecAssertion(section = Sections.CONSTRAINTSDEFINITIONIMPLEMENTATION_CONSTRAINTCOMPOSITION, id = "e")
public void testGroupsDefinedOnMainAnnotationAreInherited() {
  FrenchAddress address = getFrenchAddressWithoutZipCode();
  Set<ConstraintViolation<FrenchAddress>> constraintViolations = getValidator().validate( address );
  assertNumberOfViolations( constraintViolations, 1 );
  ConstraintViolation<FrenchAddress> constraintViolation = constraintViolations.iterator().next();
  assertCorrectConstraintTypes( constraintViolations, NotNull.class );
  NotNull notNull = (NotNull) constraintViolation.getConstraintDescriptor().getAnnotation();
  List<Class<?>> groups = Arrays.asList( notNull.groups() );
  assertTrue( groups.size() == 2, "There should be two groups" );
  assertTrue( groups.contains( Default.class ), "The default group should be in the list." );
  assertTrue(
      groups.contains( FrenchAddress.FullAddressCheck.class ),
      "The FrenchAddress.FullAddressCheck group should be inherited."
  );
}

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

@Test
@SpecAssertions({
    @SpecAssertion(section = "2.3", id = "d"),
    @SpecAssertion(section = "2.3", id = "e")
})
public void testGroupsDefinedOnMainAnnotationAreInherited() {
  Validator validator = TestUtil.getValidatorUnderTest();
  FrenchAddress address = getFrenchAddressWithoutZipCode();
  Set<ConstraintViolation<FrenchAddress>> constraintViolations = validator.validate( address );
  assertCorrectNumberOfViolations( constraintViolations, 1 );
  ConstraintViolation<FrenchAddress> constraintViolation = constraintViolations.iterator().next();
  assertCorrectConstraintTypes( constraintViolations, NotNull.class );
  NotNull notNull = ( NotNull ) constraintViolation.getConstraintDescriptor().getAnnotation();
  List<Class<?>> groups = Arrays.asList( notNull.groups() );
  assertTrue( groups.size() == 2, "There should be two groups" );
  assertTrue( groups.contains( Default.class ), "The default group should be in the list." );
  assertTrue(
      groups.contains( FrenchAddress.FullAddressCheck.class ),
      "The FrenchAddress.FullAddressCheck group should be inherited."
  );
}

代码示例来源:origin: ebean-orm/ebean

if (notNull != null && isEbeanValidationGroups(notNull.groups())) {
 prop.setNullable(false);

代码示例来源:origin: ebean-orm/ebean

if (notNull != null && isEbeanValidationGroups(notNull.groups())) {

代码示例来源:origin: io.ebean/ebean

if (notNull != null && isEbeanValidationGroups(notNull.groups())) {
 prop.setNullable(false);

代码示例来源:origin: org.avaje.ebean/ebean

if (notNull != null && isEbeanValidationGroups(notNull.groups())) {
 prop.setNullable(false);

代码示例来源:origin: io.ebean/ebean

if (notNull != null && isEbeanValidationGroups(notNull.groups())) {

代码示例来源:origin: org.avaje.ebean/ebean

if (notNull != null && isEbeanValidationGroups(notNull.groups())) {

相关文章