Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce ResolvableType.toClass() shortcut [SPR-17086] #21623

Closed
spring-projects-issues opened this issue Jul 25, 2018 · 0 comments
Closed

Introduce ResolvableType.toClass() shortcut [SPR-17086] #21623

spring-projects-issues opened this issue Jul 25, 2018 · 0 comments
Assignees
Labels
in: core type: enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Jul 25, 2018

Juergen Hoeller opened SPR-17086 and commented

With a ResolvableType argument coming into a method, there is often a need to use it as a Class, e.g. for basic assignability checks or for comparison purposes. Let's introduce a Resolvable.toClass() method which serves as a convenient non-null shortcut for resolve(Object.class) (since the basic resolve() method is nullable, a fallback has to be specified, and we can simply assume Object.class as fallback for toClass()).

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, then getRawClass() remains the right method to use, typically skipping non-null results from it.


No further details from SPR-17086

@spring-projects-issues spring-projects-issues added type: enhancement in: core labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 5.1 RC1 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core type: enhancement
Projects
None yet
Development

No branches or pull requests

2 participants