lundi 13 mars 2017

Java - get the enclosing instance

I have this class:

@Transactional
@Repository("reportManagementDAO")
public class ReportManagementDAOImpl implements ReportManagementDAO,
        Serializable{
@Autowired
private SessionFactory getSessionFactory;

public SessionFactory getSessionFactory(){
   return sessionFactory;
}

public void setSessionFactory(SessionFactory sessionFactory){
  this.sessionFactory = sessionFactory;
}

 class ReportWork extends AbstractReportWork{

 }
}//

abstract class AbstractReportWork extends RCDStoreProcedureWork {

   void doReport() {
     //How can I access to: ReportManagementDAOImpl.getSessionFactory()
     //using reflection, for example: 
     //Class<?> type = getClass().getEnclosingClass();
   }
}

How can I access to: ReportManagementDAOImpl.getSessionFactory(), by external class using reflection????





Aucun commentaire:

Enregistrer un commentaire