Bean Validation specification定义:
约束注释必须定义一个有效负载元素,该元素指定与约束声明关联的有效负载。有效负载参数的类型为
Payload[]
。Class<? extends Payload>[] payload() default {};
默认值必须是一个空数组。每个可连接的有效载荷都扩展为
Payload
。Payload
我已经阅读了其示例,但是例如,我不理解如何在JSF中使用此元数据?您能解释现实世界中有效载荷的其他用例吗?有效负载携带的元数据是什么?
也许此/**
* Payload type that can be attached to a given
* constraint declaration.
* <p/>
* Payloads are typically used to carry on metadata information
* consumed by a validation client.
* </p>
* Use of payloads is not considered portable.
*/
会帮助您。
link