jeudi 28 janvier 2016

Get generic type of a class implementing a generic interface

I have an Interface

public interface IConfigDao<T> {}

I have a class which implements this interface,

public class ConfigDaoJedisImpl<T> implements IConfigDao<T> {}

I am instantiating the class a follows,

IConfigDao<UserLimitConfig> configDao = new ConfigDaoJedisImpl<>();

Now in the constructor of ConfigDaoJedisImpl I want to get the class object of UserLimitConfig (It is the generic type with which the interface was instantiated). Is this possible?





Aucun commentaire:

Enregistrer un commentaire