The problem of JAVA8 getting generic types

ask a question about generics:
like the interface with generics below

public interface AAA<C,M,S> {}

public interface BBB<T extends Number> extends AAA<T,String,Boolean> {}

public interface CCC extends BBB<Integer> {}

public class DDD implements CCC {}

I want to get any type that inherits the AAA interface or implements the AAA interface, and what the actual type in the AAA generics parameter is corresponding to.
for example: in DDD, C = Integer, M = String, S = Boolean
BBB, C = < T extends Number >, M = String, S = Boolean

sometimes this type is used in front of the field, and there are several layers of inheritance from AAA. Is there any good way to easily know what the final type corresponds to the parameter C _ Magi _ M _ S of AAA?

Mar.16,2022

the original version forgot about the interface.

  TypeTools Maven Warehouse  

Menu