Uploaded image for project: 'Hibernate Validator'
  1. HV-769

Derive constraint target automatically for XML-configured constraints

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.0.0.CR3
    • Fix Version/s: 5.1.0.Alpha1
    • Component/s: engine
    • Labels:
      None
    • Last commented by a user?:
      true
    • Sprint:

      Description

      If a constraint which has a generic and a cross-parameter validator is applied to a method with return value and parameters, its target must be specified using the element validationAppliesTo.

      For XML-configured constraints the target could be derived automatically, since the constraint is unambigiously specified either within the return-value or cross-parameter elements. Currently one has to specify a constraint like so in this case:

      <method name="findCustomer">
          <parameter type="java.lang.String"/>
          <parameter type="java.lang.String"/>
          <return-value>
              <constraint annotation="GenericAndCrossParameterConstraint">
                  <element name="validationAppliesTo">RETURN_VALUE</element>
              </constraint>
          /return-value>
      </method>
      

      Note that the spec doesn't mandate the suggested behavior, but I think it would make sense to support it for the ease of use.

        Attachments

          Issue links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: