- Direct Known Subclasses:
- JwtValidationGenerator, ReturnValidationGenerator
public abstract class ValidationGenerator
extends java.lang.Object
We allow CDI and EJB beans to use BeanValidation to validate a JsonWebToken
instance by simply creating contstraints and putting them on that method.
BeanValidation doesn't "see" them there so we have to generate a class
that has the annotations in a place BeanValidation can see.
To accomplish this, for every method that has BeanValidation constraints
we generate an equivalent method that has those same annotations and
returns JsonWebToken.
We can then pass the generated method to BeanValidation's
ExecutableValidator.validateReturnValue and pass in the JsonWebToken instance
The only purpose of this generated class and these generated methods is to
make BeanValidation happy. If BeanValidation added something like this:
getValidator().validate(Object instance, Annotation[] annotations);
Then all the code here could be deleted.
A short example of the kind of code it generates.
This class:
public class Colors {