title: Design - Check a condition before executing every method
body: <p>I have a POJO named Document.java with 100+ member variables. There is a transformation layer, where I get the required data, transform it and store it in the Document class.</p>
  
  <p>In the tranformation layer, I would like to set a member variable only if satisfies a certain criteria (based on available context).</p>
  
  <p>So it would look something like this:</p>
  
  <pre><code>if(shouldGetExecuted1(context.getXXX())){
    document.setField1(tranformDataForField1(availableData1));
  }
  
  if(shouldGetExecuted2(context.getXXX())){
    document.setField2(tranformDataForField2(availableData2));
  }
  </code></pre>
  
  <p>I want to do this for all the 100+ fields. Is there a clean way to do this?</p>
  
  <p><strong>Additional information</strong></p>
  
  <p>I don't want to use Strategy here as it would create too many classes as the no of strategies grow.</p>