lundi 2 mars 2020

How to get all types of the inner structures of a nested type?

I have a function bellow,

public void park( List<List< List< Integer>>> l){ System.out.println("park"); }

and when I tried to use Method.getParameters() + Parameter.getParameterizedType(), I got

 java.util.List< java.util.List<java.util.List<java.lang.Integer>>>>

But, I need to get the type of the inner side of the nested structure, say, java.util.List< java.util.List<>> and Integer . When I get that, I use getAnnotationsByType to get all annotations of the inner structures.

I have thought to use the Parameter.getParameterizedType().toString() to parse the nested structure, but even if I do, I don't think the type string can be converted to Type.

Is it possible to get inner types of a nested structure? Anything is appreciated.





Aucun commentaire:

Enregistrer un commentaire