title: Java: Alternative to passing "this" as constructor argument in order to reference creating object
body: <p>I've spent a while thinking about different solutions that the one I went for as I've read around (I am not really experienced with Java yet) that using this for a constructor argument isn't usually a good practice.</p>
  
  <p>What I am trying to do is to instantiate several objects of class JobGroupMod and for every JobGroupMod I have to create a certain number of JobMod objects that must be able to reference back the JobGroupMod objects in which they've been spawned from. </p>
  
  <p>In order to accomplish that I am passing "this" to the JobMod constructor but, even if working, it didn't feel like proper designing.</p>
  
  <pre><code>public class JobGroupMod implements JobGroup {
  
      public JobGroupMod(Node n,Set&lt;Job&gt; clusterJobs){
          JobMod j=new JobMod(n,this);
      }
  }
  </code></pre>
  
  <p>And now the JobMod class:</p>
  
  <pre><code>public class JobMod implements Job {
       public JobMod(Node n, JobGroup jg){
           setJobGroup(jg);
       }
  }
  </code></pre>
  
  <p>My question is, is there a better way of solving this, or is my solution the suggested way?</p>