dimanche 6 novembre 2022

How do I instantiate a generic DAO class using reflection?

I have been trying to instantiate a generic DAO class. The problem is that I have a Class<?> class. It can be Client or Worker, so I can't specify which class is it. I tried instantiating the DAO class with Class<?>, but the DAO wont work right since I am using reflection on DAO to find out the fields the class used in generics have.

I need to do something like this.

DAO dao = new DAO<this.gerindo.getClass()>();




Aucun commentaire:

Enregistrer un commentaire