In the Hibernate 5.2.1 Reference Guide, In the Example 2.3 there is mention of annotation
@ValidPart in line 4. Is this a typo?
There is no mention of ValidPart in the rest of the reference guide.
Here is the link to the reference guide:
http://docs.jboss.org/hibernate/validator/5.2/reference/en-US/html/
Below is the content of
Example 2.3. Type argument constraint on ListCode:
package org.hibernate.validator.referenceguide.chapter02.typeargument;
public class Car {
@Valid
private List<@ValidPart String> parts = new ArrayList<>();
public void addPart(String part) {
parts.add( part );
}
//...
}
Car car = Car();
car.addPart( "Wheel" );
car.addPart( null );
Set<ConstraintViolation<Car>> constraintViolations = validator.validate( car );
assertEquals( 1, constraintViolations.size() );
assertEquals(
"'null' is not a valid car part.",
constraintViolations.iterator().next().getMessage()
);
assertEquals( "parts[1]",
constraintViolations.iterator().next().getPropertyPath().toString() );