Reputation: 5282
Hi I have the next code:
public class PkData{
@NotNull
Private String stringA;
...
}
public class A{
private PkData pkData = new PkData();
@NotNull
private Integer sequenceNumberA;
@NotNull
Private String stringA;
@NotNull
Private String stringB;
...
}
public class B{
@NotNull
private A a;
...
}
When call Set<ConstraintViolation<User>> violations = validator.validate(B);
The validator only return B errors, and not sub clases errors like A.stringA as not null.
How can do get these validations.
And if B be a B[] how can do it?
Any idea? thanks
Upvotes: 1
Views: 61
Reputation: 958
You can create validate methods in each Class A
and class PkData
which will check the value of each private fields present in them and validate those values.
Upvotes: 1