I have an interface
public interface FooBar<T> { }
I have a class that implements it
public class BarFoo implements FooBar<Person> { }
With reflection, I want to take an instance of BarFoo and get that the version of FooBar it implements is Person.
I use .getInterfaces from BarFoo to get back to FooBar, but that doesn’t help me find out what T is.
You can grab generic interfaces of a class by
Class#getGenericInterfaces()which you then in turn check if it’s aParameterizedTypeand then grab the actual type arguments accordingly.