title: JSR 303 Validation, If one field equals "something", then these other fields should not be null
body: <p>I'm looking to do a little custom validation with JSR-303 <code>javax.validation</code>.</p>
  
  <p>I have a field. And If a certain value is entered into this field I want to require that a few other fields are not <code>null</code>.</p>
  
  <p>I'm trying to figure this out. Not sure exactly what I would call this to help find an explanation. </p>
  
  <p>Any help would be appreciated. I am pretty new to this.</p>
  
  <p>At the moment I'm thinking a Custom Constraint. But I'm not sure how to test the value of the dependent field from within the annotation. Basically I'm not sure how to access the panel object from the annotation.</p>
  
  <pre><code>public class StatusValidator implements ConstraintValidator&lt;NotNull, String&gt; {
  
      @Override
      public void initialize(NotNull constraintAnnotation) {}
  
      @Override
      public boolean isValid(String value, ConstraintValidatorContext context) {
          if ("Canceled".equals(panel.status.getValue())) {
              if (value != null) {
                  return true;
              }
          } else {
              return false;
          }
      }
  }
  </code></pre>
  
  <p>It's the <code>panel.status.getValue();</code> giving me trouble.. not sure how to accomplish this.</p>