samedi 4 février 2017

Getting generic type of super interface via reflection

interface BaseDao<T> { }

interface UserDao extends BaseDao<User> { }

interface DeptDao extends BaseDao<Department> { }

I need a function get Entity class via Dao class, like this:

func(UserDao.class) return User.class
func(DeptDao.class) return Deparment.class  

and I don't like add annotation todao, like this:

@Entity(User.class)
interface UserDao extends BaseDao





Aucun commentaire:

Enregistrer un commentaire