Should this be compatible with 5.1 (BV 1.1) and / or 6.0 (or BV 2.0) ?
The latter. 5.x will only receive bug fixes at this point.
Should this be API only (HibernateValidatorConfiguration) or also XML based ?
Having both would be good eventually, but I'd focus on the API first.
Any preference for SPI naming and signature ?
Not really, I'd hope you could come up with a proposal after exploring a bit? A simple predicate won't cut it, as we need to return the name of the represented property, given a method. The input should not be ConstrainedExecutable as that's an internal implementation type. This might be a good starting point:
enum MethodType { PROPERTY_READ_ACCESSOR, OTHER; }
interface PropertyAcessorSelector {
MethodType getType(Method method);
String getPropertyName(Method propertyReadAccessor);
}
If using Java 8 (6.0 version) is simple Predicate<ConstrainedExecutable> sufficient
I don't think so, see above.
What's recommended way to pass SPI instance from ConfigurationImpl all the way
Check out how it's done for other things, e.g. ConstraintHelper. There is no DI or so, all dependencies are passed through the constructors down the object graph. It may be a good idea to make this new functionality available via ExecutableHelper. That's present in many of the constructor's already, so you'll likely have to adjust only a few places. Also see how ValidatorFactoryImpl is accessing the HV-specific settings on Configuration. |