lundi 4 janvier 2016

Getting actual generic types of "super super" class or interface using reflection

I have the following interface/classes structure:

public interface IConverter<I, O> {    
    O convert(I value);
}
class ToViewConverter<I, O> implements IConverter<I, O>;
class NameToViewConverter<O> extends ToViewConverter<String, O>;
class RoleNameToViewConverter extends NameToViewConverter<Integer>;

I want ot get the ACTUAL types and (from IConverter) in runtime using refelection. For the example of RoleNameToViewConverter, I want to get String and Integer respectively. Is there any way to do that? Thanks!





Aucun commentaire:

Enregistrer un commentaire