Refine '?' use in Kotlin code

This commit is contained in:
Stéphane Nicoll
2025-05-08 22:54:30 -07:00
committed by Phillip Webb
parent 7035c0fa0a
commit 0510cfa684
15 changed files with 21 additions and 21 deletions

View File

@@ -21,7 +21,7 @@ import org.springframework.data.domain.Pageable
import org.springframework.data.repository.Repository
interface CityRepository :
Repository<City?, Long?> {
fun findAll(pageable: Pageable?): Page<City?>?
fun findByNameAndStateAllIgnoringCase(name: String?, state: String?): City?
Repository<City, Long> {
fun findAll(pageable: Pageable?): Page<City>
fun findByNameAndStateAllIgnoringCase(name: String, state: String): City?
}

View File

@@ -23,9 +23,9 @@ import org.springframework.data.repository.Repository
import org.springframework.data.repository.history.RevisionRepository
interface CountryRepository :
RevisionRepository<Country?, Long?, Int>,
Repository<Country?, Long?> {
RevisionRepository<Country, Long, Int>,
Repository<Country, Long> {
fun findAll(pageable: Pageable?): Page<Country?>?
fun findAll(pageable: Pageable?): Page<Country>?
}

View File

@@ -21,9 +21,9 @@ import org.springframework.data.domain.Page
import org.springframework.data.domain.Pageable
import org.springframework.data.repository.Repository
interface CityRepository : Repository<City?, Long?> {
interface CityRepository : Repository<City, Long> {
fun findAll(pageable: Pageable?): Page<City?>?
fun findAll(pageable: Pageable?): Page<City>?
fun findByNameAndStateAllIgnoringCase(name: String?, state: String?): City?

View File

@@ -19,8 +19,8 @@ package org.springframework.boot.docs.data.sql.r2dbc.repositories
import org.springframework.data.repository.Repository
import reactor.core.publisher.Mono
interface CityRepository : Repository<City?, Long?> {
interface CityRepository : Repository<City, Long> {
fun findByNameAndStateAllIgnoringCase(name: String?, state: String?): Mono<City?>?
fun findByNameAndStateAllIgnoringCase(name: String, state: String): Mono<City?>
}

View File

@@ -29,7 +29,7 @@ class MyService(restClientBuilder: RestClient.Builder) {
restClient = restClientBuilder.baseUrl("https://example.org").build()
}
fun someRestCall(name: String?): Details {
fun someRestCall(name: String): Details {
return restClient.get().uri("/{name}/details", name)
.retrieve().body(Details::class.java)!!
}

View File

@@ -31,7 +31,7 @@ class MyService(restClientBuilder: RestClient.Builder, ssl: RestClientSsl) {
.apply(ssl.fromBundle("mybundle")).build()
}
fun someRestCall(name: String?): Details {
fun someRestCall(name: String): Details {
return restClient.get().uri("/{name}/details", name)
.retrieve().body(Details::class.java)!!
}

View File

@@ -38,7 +38,7 @@ class MyService(restClientBuilder: RestClient.Builder, sslBundles: SslBundles) {
.requestFactory(requestFactory).build()
}
fun someRestCall(name: String?): Details {
fun someRestCall(name: String): Details {
return restClient.get().uri("/{name}/details", name).retrieve().body(Details::class.java)!!
}

View File

@@ -29,7 +29,7 @@ class MyService(webClientBuilder: WebClient.Builder) {
webClient = webClientBuilder.baseUrl("https://example.org").build()
}
fun someRestCall(name: String?): Mono<Details> {
fun someRestCall(name: String): Mono<Details> {
return webClient.get().uri("/{name}/details", name)
.retrieve().bodyToMono(Details::class.java)
}

View File

@@ -31,7 +31,7 @@ class MyService(webClientBuilder: WebClient.Builder, ssl: WebClientSsl) {
.apply(ssl.fromBundle("mybundle")).build()
}
fun someRestCall(name: String?): Mono<Details> {
fun someRestCall(name: String): Mono<Details> {
return webClient.get().uri("/{name}/details", name)
.retrieve().bodyToMono(Details::class.java)
}

View File

@@ -38,7 +38,7 @@ class MyKafkaStreamsConfiguration {
return stream
}
private fun uppercaseValue(key: Int, value: String): KeyValue<Int?, String?> {
private fun uppercaseValue(key: Int, value: String): KeyValue<Int, String> {
return KeyValue(key, value.uppercase())
}

View File

@@ -19,7 +19,7 @@ package org.springframework.boot.docs.web.reactive.webflux
import org.springframework.data.repository.reactive.ReactiveCrudRepository
import reactor.core.publisher.Flux
interface CustomerRepository : ReactiveCrudRepository<Customer?, Long?> {
interface CustomerRepository : ReactiveCrudRepository<Customer, Long> {
fun findByUser(user: User?): Flux<Customer?>?

View File

@@ -29,7 +29,7 @@ import reactor.core.publisher.Mono
class MyRestController(private val userRepository: UserRepository, private val customerRepository: CustomerRepository) {
@GetMapping("/{userId}")
fun getUser(@PathVariable userId: Long): Mono<User?> {
fun getUser(@PathVariable userId: Long): Mono<User> {
return userRepository.findById(userId)
}

View File

@@ -18,4 +18,4 @@ package org.springframework.boot.docs.web.reactive.webflux
import org.springframework.data.repository.reactive.ReactiveCrudRepository
interface UserRepository : ReactiveCrudRepository<User?, Long?>
interface UserRepository : ReactiveCrudRepository<User, Long>

View File

@@ -18,7 +18,7 @@ package org.springframework.boot.docs.web.servlet.springmvc
import org.springframework.data.repository.CrudRepository
interface CustomerRepository : CrudRepository<Customer?, Long?> {
interface CustomerRepository : CrudRepository<Customer, Long> {
fun findByUser(user: User?): List<Customer>?

View File

@@ -18,4 +18,4 @@ package org.springframework.boot.docs.web.servlet.springmvc
import org.springframework.data.repository.CrudRepository
interface UserRepository : CrudRepository<User?, Long?>
interface UserRepository : CrudRepository<User, Long>