On  Jun 18, 2009, at 09:36, Hardy Ferentschik wrote:

Hi,

another question. The spec says that groups are interfaces, but it is not specific about what happens if non interface classes
are passed to validate:

        /**
         * Validates all constraints on object.
         *
         * @param object object to validate
         * @param groups groups targeted for validation
         * (default to {...@link javax.validation.groups.Default})
         *
         * @return constraint violations or an empty Set if none
         *
         * @throws IllegalArgumentException if object is null
         * @throws ValidationException    if a non recoverable error happens
         *                                  during the validation process
         */
<T> Set<ConstraintViolation<T>> validate(T object, Class<?>... groups);

Should an IllegalArgumentException be thrown if the class is not an interface?

I don't want the spec to limit innovation, That's why the exception model is not specified. Some product can support Class groups.


Related to this:
"Since sequences cannot have circular dependencies, using Default in the declaration of a sequence is not an op- tion. Constraints hosted on a class A and belonging to the Default group (by default or explicitly) implicitly belong
to the group A."

Does this imply I should be able to call Validator.validate(aInstance, A.class)? That would violate the statement that
groups are interfaces. Is group A just a "conceptual" group?

Yes A is a conceptual group.

PS: let's have these discussions on hibernate-dev. People can share that and that will be searchable.


--Hardy

_______________________________________________
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev

Reply via email to