本文整理了Java中javax.validation.constraints.NotNull.groups()
方法的一些代码示例,展示了NotNull.groups()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。NotNull.groups()
方法的具体详情如下:
包路径:javax.validation.constraints.NotNull
类名称: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())) {
内容来源于网络,如有侵权,请联系作者删除!