vendredi 12 juin 2020

How to check if java.reflect.Type value is a subclass of a generic class?

I have a method that gives me the type of an object:

public void decode(java.reflect.Type type){
      //how to check if type extends MyAbstract.class?
}

And I need to make a cast if the type extends MyAbstract, an abstract class I created. I tried with:

type instanceof MyAbstract

but doesn't seem to work...do you have any ideas?





Aucun commentaire:

Enregistrer un commentaire