[bv-dev] Metadata API - Representation of container element constraints

Gunnar Morling gunnar at hibernate.org
Sun Apr 23 04:51:54 EDT 2017


Hi,

In the constraint metadata API we currently have two new methods:

* getConstraintsForContainerElementType(int) (for returning a
descriptor for a specific type argument) and
* getConstrainedContainerElementTypes() which returns a descriptor for
those type arguments which are constrained or marked for cascaded
validation (themselves or nested).

This is similar to BeanDescriptor#getConstraintsForProperty() and
getConstrainedProperties().

Should we instead have a single method getContainerElementTypes ()
which returns descriptors for all the type arguments of an element, be
them constrained or not? That'd be similar to
ExecutableDescriptor#getParameterDescriptors() where we also return a
descriptor for each parameter. It'd also allow for better evolution
towards array support. That single method would make sense for array
types, too, whereas getConstraintsForContainerElementType(int) is
dubious.

Thus I feel the latter would be a bit better. Thoughts?

Thanks,

--Gunnar


More information about the beanvalidation-dev mailing list