2010/10/6 Emmanuel Bernard <emman...@hibernate.org>
> > Too sad, that javax.validation.ValidatorContext is not defined as > > public interface ValidatorContext <V extends ValidatorContext<V>> { > > } > > If it were, we wouldn't need a dedicated method > HibernateValidatorFactory#usingHibernateContext(), but > HibernateValidatorFactory could be defined as > > public interface HibernateValidatorFactory extends ValidatorFactory { > > HibernateValidatorContext usingContext(); > > } > > then, allowing the validator to be retrieved like that: > > failFastValidator = > factory.unwrap(HibernateValidatorFactory.class) > .usingContext() > .maxConstraintViolationCount(5) > .getValidator(); > > > Yes I've hesitated back in the days and thought unwrap was enough :( > I wonder if we can retroactively enhance it without breaking clients. > > I'm not totally sure. I tried it out and a quick look didn't show any real problems. People assigning the ValidatorContext to a variable would get a "raw type" warning. Per se that's no problem, plus I think hardly anybody would do that anyway as there simply is no need store the context when building a validator. _______________________________________________ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev