Introduce ResolvableType.toClass() shortcut [SPR-17086] #21623
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: enhancement
A general enhancement
Milestone
Juergen Hoeller opened SPR-17086 and commented
With a
ResolvableType
argument coming into a method, there is often a need to use it as aClass
, e.g. for basic assignability checks or for comparison purposes. Let's introduce aResolvable.toClass()
method which serves as a convenient non-null shortcut forresolve(Object.class)
(since the basicresolve()
method is nullable, a fallback has to be specified, and we can simply assumeObject.class
as fallback fortoClass()
).For many purposes, this is also an alternative to
ResolvableType.getRawClass()
: non-null and also taking resolved top-level type variables into account. However, if code wants to actually check the top-level raw type in a parameterized arrangement, e.g. expecting a fixed outer collection declaration, thengetRawClass()
remains the right method to use, typically skipping non-null results from it.No further details from SPR-17086
The text was updated successfully, but these errors were encountered: