반응형
참고사이트
:https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/core/ResolvableType.html
Encapsulates a Java Type
, providing access to supertypes
, interfaces
, and generic parameters
along with the ability to ultimately resolve
to a Class
.
ResolvableTypes
may be obtained from fields
, method parameters
, method returns
or classes
. Most methods on this class will themselves return ResolvableType
s, allowing easy navigation. For example:
private HashMap<Integer, List<String>> myMap; public void example() { ResolvableType t = ResolvableType.forField(getClass().getDeclaredField("myMap")); t.getSuperType(); // AbstractMap<Integer, List<String>> t.asMap(); // Map<Integer, List<String>> t.getGeneric(0).resolve(); // Integer t.getGeneric(1).resolve(); // List t.getGeneric(1); // List<String> t.resolveGeneric(1, 0); // String }
반응형