title: Is there a better way/pattern to tag the content of a POJO in different "sizes"?
body: <p>Well I'm playing a little bit with threads in Java and ended up with a "try" to tag the "size" of the objects instantiated. Lets say I want to open the evaluation of the sizes to the implementer and make the process using threads as much transparent as possible of the objects to process.</p>
  
  <p>I want to improve if its possible the following class sizes markers. I tried with @annotations but I can't force the implementations to retrieve the size based on the object content(that's why the interface with the method <code>ExecutionerSize getSize()</code>)</p>
  
  <p>As parents I have this class and interface:</p>
  
  <pre><code>public class WorkerEntity implements ExecutionerSize{
      @Override
      public ExecutionerSize getSize() {
          "implementation of the evaluation to get the size..."
      }
  }
  
  public interface ExecutionerSize {
      ExecutionerSize getSize();
  }
  </code></pre>
  
  <p>As children of the previous class and interface:</p>
  
  <pre><code>public interface Large extends ExecutionerSize{
  }
  public interface Medium extends ExecutionerSize{
  }
  public interface Small extends ExecutionerSize{
  }
  
  public class WorkerEntityLarge extends WorkerEntity implements Large {
  }
  public class WorkerEntityMedium extends WorkerEntity implements Medium{
  }
  public class WorkerEntitySmall extends WorkerEntity implements Small{
  }
  </code></pre>
  
  <p>And here its my "problem" this is the only way I accomplish to success the split of the <code>List&lt;ExecutionerSize&gt;</code> </p>
  
  <pre><code>private List&lt;WorkerEntity&gt;[] splitListIntoSizes(List&lt;ExecutionerSize&gt; objectsToProcess) {
          List&lt;Small&gt; smallList = new ArrayList&lt;&gt;();
          List&lt;Medium&gt; mediumList = new ArrayList&lt;&gt;();
          List&lt;Large&gt; largeList = new ArrayList&lt;&gt;();
          objectsToProcess.forEach(object -&gt; {
              ExecutionerSize objectSized = object.getSize();
              if (objectSized instanceof WorkerEntitySmall) {
                  smallList.add((WorkerEntitySmall) objectSized);
              } else if (objectSized instanceof WorkerEntityMedium) {
                  mediumList.add((WorkerEntityMedium) objectSized);
              } else {
                  largeList.add((WorkerEntityLarge) objectSized);
              }
          });
          return new List[]{smallList, mediumList, largeList};
   }
  </code></pre>
  
  <p>For more code details here is the github repo: <a href="https://github.com/RJansenGomez/ThreadsPoc" rel="nofollow noreferrer">https://github.com/RJansenGomez/ThreadsPoc</a></p>