title: How to validate nested objects for Null values
body: <p><br/>
  I am working on a service which receives a request from the upstream system.<br/></p>
  
  <ul>
  <li>The request can have about 300 fields.</li>
  <li>My task is to process the order, but before processing the order, I have to perform data validation.</li>
  <li>Data validation mainly involves null &amp; empty checks. I have to check at-least whether all the mandatory fields are neither empty nor null.</li>
  </ul>
  
  <p>Order DTO:
  <br/></p>
  
  <pre><code>public class Order{
     private String orderId;
     private String sourceOrder;
     private String destinationSystem;
     private String orderingTimeStamp;
     private List&lt;Mapper&gt; properties;
            ....
  }
  </code></pre>
  
  <p>I don't want to check null on each step, like
  <code>if(sourceOrder!=null &amp;&amp; !sourceOrder.isEmpty())</code>, as I would end up writing a lot of boilerplate code.<br/>
  So, I thought before processing the order, let's validate the order for <code>null &amp; empty</code> checks. If all mandatory values are present, then process the order else reject the order.</p>
  
  <p><br/>
  I am aware of <code>@NotNull</code> annotation, but that won't work for nested objects for example <code>private List&lt;Mapper&gt; properties</code>, will have a list of objects. Out of those elements I want to validate only selected and not all. <br/></p>
  
  <p><br/>
  For example, I have to validate only <code>"firstName", "lastName", "Address"</code> in the <code>List&lt;Mapper&gt; properties</code>, not all.
  <br/>
  Is there any way to achieve it, or do we have any design pattern/framework to do this?<br/>
  Please help.</p>