title: java extend or wrap a class to add extra functionality
body: <p>When you want to add some extra information into a class, what way would you prefer: would you extend that class or make a wrapper around it?</p>
  
  <p>In my particular scenario, I want to add some pagination information with a <code>List</code> that I get from database. That pagination information will include:</p>
  
  <pre><code>int currentPage;
  int totalResults;
  int containedResultsIndex;
  int totalcontainedResults;
  </code></pre>
  
  <p>and a couple of methods:</p>
  
  <pre><code>Boolean isNextPageAvailable();
  Boolean isPrevPageAvailable();
  </code></pre>
  
  <p>Whats your opinion, extend or wrap?</p>