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

Use Map.getOrDefault in AbstractSqlParameterSource.getSqlType [SPR-15238] #19803

Closed
spring-projects-issues opened this issue Feb 9, 2017 · 2 comments
Assignees
Labels
in: data type: enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Feb 9, 2017

Jonathan Borenstein opened SPR-15238 and commented

The getOrDefault method for Maps in Java 8 can be used throughout the Spring Framework if applicable.


Referenced from: pull request #1321, and commits c0f4d78

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Feb 9, 2017

Juergen Hoeller commented

I see getOrDefault as a convenience method that's only really useful for constant default values. Performing object construction or retrieval for a default value is arguably an expensive operation that should only be triggered when necessary, in particular when we are likely to encounter a cache hit. getOrDefault unfortunately suggests a less-than-optimal idiom there.

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Feb 9, 2017

Juergen Hoeller commented

In the discussion on the pull request, we ruled out cases with expensive default calculation but identified AbstractSqlParameterSource.getSqlType as a remaining worthwhile change.

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

No branches or pull requests

2 participants