Java generics: get class of generic method's return type
Unfortunately, you will certainly have to change your method to:
private <T> T evaluate(Class<T> clazz, String expression)
and then pass clazz
as your second parameter. Not as short as you expected.