title: Validate object field by conditions using Spring
body: <p>I have a complex object that contains two <code>UserPropertyForm</code> objects inside:</p>
  
  <pre><code>    public class ComplexUserForm {
         int userType;
  
         @Valid
         UserPropertyForm property1;
         UserPropertyForm property2;
         ...
      }
  
      public class UserPropertyForm {
         @NotEmpty
         @Length(max = 255)
         private String title;
         @NotEmpty
         @Length(min = 100)
         private String description;
         ...
      }
  </code></pre>
  
  <p>I need <code>property1</code> be validated every time, so I have marked it as <code>@Valid</code>. <br/>
  I need <code>property2</code> be validated only if <code>userType == 2</code></p>
  
  <p>Could anyone say if I can validate <code>property2</code> in a simple way using annotations I have for <code>UserPropertyForm</code> fields?</p>
  
  <p>Thanks for any help.</p>