public abstract class BaseDaoImpl<E extends AbstractEntity> implements BaseDao<E> {
.....
public BaseDaoImpl() throws DataAccessException {
logger = LoggerFactory.getLogger(E); <<-- error here.
}
In the above code I get a error in the call to getLogger(E).
E cannot be resolved to a variable
This makes sense, but getLogger(E.class) (or variants thereof) does not work either.
I don't want to pass the literal class in the constructor, so a solution like changing the the constructor header to:
public BaseDaoImpl(Class<E> clazz) ... is not an option.
How do I get the class type from E?
Note that the answers to: How to get class of generic type when there is no parameter of it?
do not help.