V
V
Vladyslav2021-02-20 17:40:02
Java
Vladyslav, 2021-02-20 17:40:02

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

1 answer(s)
O
Orkhan, 2021-02-20
Hasanly @azerphoenix

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...
6031262181841223775751.png
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 question

Ask a Question

731 491 924 answers to any question