jeudi 25 octobre 2018

How to check if the "?" of a Class?> object instanceof SomeInterface

Simple-looking-problem, but I'm starting to think I'm trying to achieve something the wrong way. Let's say I have a Method object correctly initialized.

I need to check if that method will return an object implementing the Comparable interface.

The problem is method.getReturnType() returns a Class<?> object, I want to check if this "?" actually is an instance of Comparable, but I can't write ? instanceof Comparable, how would anyone do that?





Aucun commentaire:

Enregistrer un commentaire