title: possible to check cross fields constraint in the middle of method
body: <p>We have a service class in Java 8 SpringBoot application that needs to check if a field of object A matches object B passed in as a method parameter. It would have worked beautifully using ConstraintValidator if all method signatures took Object A &amp; Object B as parameters. </p>
  
  <p>Method in service class:</p>
  
  <pre><code>@Override
  @MyCheck
  public String serviceDoLogic(Object B, Object A) {
      ......
  }
  </code></pre>
  
  <p>Validator class:</p>
  
  <pre><code>@SupportedValidationTarget(ValidationTarget.PARAMETERS)
  public class MyCheckValidator implements ConstraintValidator&lt;MyCheck, Object[]&gt; {
  
  
    @Override
    public boolean isValid(
          Object[] value,
          ConstraintValidatorContext context) {
  
      if( value.length &lt;2 ) {
          return true;
      }
      if ( ! value[0].equals(value[1].myField()) {
         return false;
      }
      return true;
    }
  }
  </code></pre>
  
  <p>Unfortunately, for some methods in the service class, it can only take a String identifier for Object A (as it is the only thing known at the time), and within the service, it needs to call DAO to get Object A. Thus the constraint cannot be triggered for them.</p>
  
  <p>Any solution, other than having the check logic embedded in every method that needs it, to get it done in an elegant way? Hope I explain it well</p>
  
  <p>Many thanks in advance</p>