Answer the question
In order to leave comments, you need to log in
What does the Payload method of javax.validation.Payload mean?
People, please tell me what these 2 methods from
javax.validation.Payload do, I can’t fully grasp the essence:
Class<?>[] groups() default {}; - This one narrows the action of the annotation to the given classes, right?
Class<? extends Payload>[] payload() default {}; - why this one?
They are always written when creating annotations in Java
Answer the question
In order to leave comments, you need to log in
Good afternoon!
This essentially also narrows the action, but allows you to apply to custom Constraints
https://docs.jboss.org/hibernate/validator/4.1/ref...
https://beanvalidation.org/1.1/spec/
Payloads are typically used by validation clients to associate some metadata information with a given constraint declaration. Payloads are typically non-portable. Describing payloads as interface extensions as opposed to a string-based approach allows an easier and more type-safe approach.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question