Commit 239f384
Update PropertyMapper to better support nullability
Refactor `PropertyMapper` so that it no longer calls adapter or
predicate methods by default when the source value is `null`. This
effectively makes all default calls the same as using
`alwaysWhenNotNull` in the previous generation of the code.
For the limited times when you do need to deal with `null` values, the
new `always()` method can be used.
For example,
map.from(source::method).to(destination::method);
Will not call `destination.method(...)` if `source.method()` returns
`null`.
Where as:
map.from(source::method).always().to(destination::method);
Will call `destination.method(null)` if `source.method()` returns
`null`.
This update provides clearer semantics for the API and allows for better
JSpecify nullability annotations. It has also simplified much of our
existing property mapper code.
Closes gh-47024
Co-authored-by: Moritz Halbritter <[email protected]>1 parent 2d63763 commit 239f384
File tree
85 files changed
+572
-372
lines changed- core
- spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web
- spring-boot/src
- main/java/org/springframework/boot
- context/properties
- logging/structured
- task
- test/java/org/springframework/boot/context/properties
- modules/appendix/pages
- module
- spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/web
- spring-boot-amqp/src/main/java/org/springframework/boot/amqp/autoconfigure
- spring-boot-cassandra/src/main/java/org/springframework/boot/cassandra/autoconfigure
- spring-boot-data-mongodb/src/main/java/org/springframework/boot/data/mongodb/autoconfigure
- spring-boot-data-redis/src/main/java/org/springframework/boot/data/redis/autoconfigure
- spring-boot-data-rest/src/main/java/org/springframework/boot/data/rest/autoconfigure
- spring-boot-elasticsearch/src/main/java/org/springframework/boot/elasticsearch/autoconfigure
- spring-boot-flyway/src/main/java/org/springframework/boot/flyway/autoconfigure
- spring-boot-graphql/src/main/java/org/springframework/boot/graphql/autoconfigure
- spring-boot-groovy-templates/src/main/java/org/springframework/boot/groovy/template/autoconfigure
- spring-boot-gson/src/main/java/org/springframework/boot/gson/autoconfigure
- spring-boot-http-client/src
- main/java/org/springframework/boot/http/client
- autoconfigure
- reactive
- test/java/org/springframework/boot/http/client
- spring-boot-http-codec/src/main/java/org/springframework/boot/http/codec/autoconfigure
- spring-boot-integration/src/main/java/org/springframework/boot/integration/autoconfigure
- spring-boot-jetty/src/main/java/org/springframework/boot/jetty/autoconfigure
- spring-boot-jms/src/main/java/org/springframework/boot/jms/autoconfigure
- spring-boot-kafka/src/main/java/org/springframework/boot/kafka/autoconfigure
- spring-boot-ldap/src/main/java/org/springframework/boot/ldap/autoconfigure
- spring-boot-mustache/src/main/java/org/springframework/boot/mustache/autoconfigure
- spring-boot-pulsar/src/main/java/org/springframework/boot/pulsar/autoconfigure
- spring-boot-r2dbc/src/main/java/org/springframework/boot/r2dbc
- autoconfigure
- spring-boot-reactor-netty/src/main/java/org/springframework/boot/reactor/netty/autoconfigure
- spring-boot-restclient/src/main/java/org/springframework/boot/restclient/autoconfigure
- spring-boot-rsocket/src/main/java/org/springframework/boot/rsocket
- autoconfigure
- netty
- spring-boot-security-oauth2-authorization-server/src/main/java/org/springframework/boot/security/oauth2/server/authorization/autoconfigure/servlet
- spring-boot-security-oauth2-client/src/main/java/org/springframework/boot/security/oauth2/client/autoconfigure
- spring-boot-security-oauth2-resource-server/src/main/java/org/springframework/boot/security/oauth2/server/resource/autoconfigure
- reactive
- servlet
- spring-boot-security-saml2/src/main/java/org/springframework/boot/security/saml2/autoconfigure
- spring-boot-servlet/src/main/java/org/springframework/boot/servlet/autoconfigure
- spring-boot-session-data-mongodb/src/main/java/org/springframework/boot/session/data/mongodb/autoconfigure
- spring-boot-session-data-redis/src/main/java/org/springframework/boot/session/data/redis/autoconfigure
- spring-boot-session-hazelcast/src/main/java/org/springframework/boot/session/hazelcast/autoconfigure
- spring-boot-session-jdbc/src/main/java/org/springframework/boot/session/jdbc/autoconfigure
- spring-boot-session/src/main/java/org/springframework/boot/session/autoconfigure
- spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/restdocs
- spring-boot-thymeleaf/src/main/java/org/springframework/boot/thymeleaf/autoconfigure
- spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/autoconfigure
- spring-boot-web-server-test/src/main/java/org/springframework/boot/web/server/test/client
- spring-boot-web-server/src/main/java/org/springframework/boot/web/server
- autoconfigure
- reactive
- servlet
- servlet
- spring-boot-webclient/src/main/java/org/springframework/boot/webclient/autoconfigure
- spring-boot-webflux/src/main/java/org/springframework/boot/webflux/autoconfigure
- spring-boot-webmvc/src/main/java/org/springframework/boot/webmvc/autoconfigure
- spring-boot-webservices/src/main/java/org/springframework/boot/webservices/client
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
85 files changed
+572
-372
lines changedLines changed: 0 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
576 | 576 | | |
577 | 577 | | |
578 | 578 | | |
579 | | - | |
580 | 579 | | |
581 | 580 | | |
582 | | - | |
583 | 581 | | |
584 | 582 | | |
585 | | - | |
586 | 583 | | |
587 | 584 | | |
588 | 585 | | |
| |||
0 commit comments