do you remember why we did it that way?
ConstraintDefinitionContributor is an more overarching/powerful solution to the constraint-definition element in the constraint-mapping.xml. For example its default implementation uses the Java ServiceLoader to detect constraint definitions. I don't think that we could completely move the whole concept into ConstraintMapping. There will imo still be a need/use for offering access to ConstraintDefinitionContributor via the configuration. Also, I never actually liked the fact that constraint-definition is defined in constraint-mapping. Since it is a global configuration I think it might have been better off in validation.xml
It's marked as experimental, so I'm inclined to alter it as described above.
Not sure. I am more inclined to say to either just go with the current approach or also add explicit support in ConstraintMapping which will complete the mirroring of the functionality of constraint-mapping.xml. In this case there is a certain overlap in functionality, but I think this is consistent. After all it is perfectly ok, to define constraint definitions in xml, but have additional definitions contributed by the ConstraintDefinitionContributor contract. |