My setup is as below -
public class ParentModel {
private StatusModel sm;
}
StatusModel class is as below -
public class StatusModel {
private ParentModel pm;
public void setParentModel(ParentModel pm) {
this.pm = pm;
}
}
pm inside StatusModel is the reference of ParentModel instance upon which the StatusModel depends.
Inside dao - I'm injecting ParentModel as below
@Inject
private Instance<ParentModel> factory;
but, setting ParentModel reference to StatusModel using a separate method call as below -
pm = factory.get();
pm.setters...
pm.getSm().setParentModel(pm);//<----- is it possible to avoid this?
Can we obtain the pm reference inside sm without a method call?