Skip to content

Commit d2b3ba9

Browse files
committed
Nullability annotation cleanup.
1 parent 33973ec commit d2b3ba9

File tree

5 files changed

+2
-15
lines changed

5 files changed

+2
-15
lines changed

src/main/antora/modules/ROOT/pages/elasticsearch/object-mapping.adoc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,7 @@ public String getProperty() {
192192

193193
This annotation can be set on a String property of an entity.
194194
This property will not be written to the mapping, it will not be stored in Elasticsearch and its value will not be read from an Elasticsearch document.
195-
After an entity is persisted, for example with a call to `ElasticsearchOperations.save(T entity)`, the entity
196-
returned from that call will contain the name of the index that an entity was saved to in that property.
195+
After an entity is persisted, for example with a call to `ElasticsearchOperations.save(T entity)`, the entity returned from that call will contain the name of the index that an entity was saved to in that property.
197196
This is useful when the index name is dynamically set by a bean, or when writing to a write alias.
198197

199198
Putting some value into such a property does not set the index into which an entity is stored!
@@ -423,7 +422,6 @@ Looking at the `Configuration` from the xref:elasticsearch/object-mapping.adoc#e
423422
@Configuration
424423
public class Config extends ElasticsearchConfiguration {
425424
426-
@NonNull
427425
@Override
428426
public ClientConfiguration clientConfiguration() {
429427
return ClientConfiguration.builder() //

src/main/java/org/springframework/data/elasticsearch/core/AbstractElasticsearchTemplate.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
import org.springframework.data.mapping.callback.EntityCallbacks;
5858
import org.springframework.data.mapping.context.MappingContext;
5959
import org.springframework.data.util.Streamable;
60-
import org.springframework.lang.NonNull;
6160
import org.springframework.lang.Nullable;
6261
import org.springframework.util.Assert;
6362
import org.springframework.util.StringUtils;
@@ -779,8 +778,7 @@ public T doWith(@Nullable Document document) {
779778
}
780779

781780
protected interface SearchDocumentResponseCallback<T> {
782-
@NonNull
783-
T doWith(@NonNull SearchDocumentResponse response);
781+
T doWith(SearchDocumentResponse response);
784782
}
785783

786784
protected class ReadSearchDocumentResponseCallback<T> implements SearchDocumentResponseCallback<SearchHits<T>> {
@@ -795,7 +793,6 @@ public ReadSearchDocumentResponseCallback(Class<T> type, IndexCoordinates index)
795793
this.type = type;
796794
}
797795

798-
@NonNull
799796
@Override
800797
public SearchHits<T> doWith(SearchDocumentResponse response) {
801798
List<T> entities = response.getSearchDocuments().stream().map(delegate::doWith).collect(Collectors.toList());
@@ -816,7 +813,6 @@ public ReadSearchScrollDocumentResponseCallback(Class<T> type, IndexCoordinates
816813
this.type = type;
817814
}
818815

819-
@NonNull
820816
@Override
821817
public SearchScrollHits<T> doWith(SearchDocumentResponse response) {
822818
List<T> entities = response.getSearchDocuments().stream().map(delegate::doWith).collect(Collectors.toList());

src/main/java/org/springframework/data/elasticsearch/core/AbstractReactiveElasticsearchTemplate.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
import org.springframework.data.elasticsearch.core.suggest.response.Suggest;
5656
import org.springframework.data.elasticsearch.support.VersionInfo;
5757
import org.springframework.data.mapping.callback.ReactiveEntityCallbacks;
58-
import org.springframework.lang.NonNull;
5958
import org.springframework.lang.Nullable;
6059
import org.springframework.util.Assert;
6160

@@ -575,7 +574,6 @@ protected interface DocumentCallback<T> {
575574
* @param document the document to convert
576575
* @return a Mono of the entity
577576
*/
578-
@NonNull
579577
Mono<T> toEntity(@Nullable Document document);
580578
}
581579

@@ -593,7 +591,6 @@ public ReadDocumentCallback(EntityReader<? super T, Document> reader, Class<T> t
593591
this.index = index;
594592
}
595593

596-
@NonNull
597594
public Mono<T> toEntity(@Nullable Document document) {
598595
if (document == null) {
599596
return Mono.empty();

src/test/java/org/springframework/data/elasticsearch/config/configuration/ElasticsearchConfigurationELCTests.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
3232
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
3333
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories;
34-
import org.springframework.lang.NonNull;
3534
import org.springframework.lang.Nullable;
3635
import org.springframework.test.context.ContextConfiguration;
3736
import org.springframework.test.context.junit.jupiter.SpringExtension;
@@ -50,7 +49,6 @@ public class ElasticsearchConfigurationELCTests {
5049
@EnableElasticsearchRepositories(basePackages = { "org.springframework.data.elasticsearch.config.configuration" },
5150
considerNestedRepositories = true)
5251
static class Config extends ElasticsearchConfiguration {
53-
@NonNull
5452
@Override
5553
public ClientConfiguration clientConfiguration() {
5654
return ClientConfiguration.builder() //

src/test/java/org/springframework/data/elasticsearch/config/configuration/ReactiveElasticsearchConfigurationELCTests.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import org.springframework.data.elasticsearch.core.ReactiveElasticsearchOperations;
3030
import org.springframework.data.elasticsearch.repository.ReactiveElasticsearchRepository;
3131
import org.springframework.data.elasticsearch.repository.config.EnableReactiveElasticsearchRepositories;
32-
import org.springframework.lang.NonNull;
3332
import org.springframework.lang.Nullable;
3433
import org.springframework.test.context.ContextConfiguration;
3534
import org.springframework.test.context.junit.jupiter.SpringExtension;
@@ -48,7 +47,6 @@ public class ReactiveElasticsearchConfigurationELCTests {
4847
considerNestedRepositories = true)
4948
static class Config extends ReactiveElasticsearchConfiguration {
5049

51-
@NonNull
5250
@Override
5351
public ClientConfiguration clientConfiguration() {
5452
return ClientConfiguration.builder() //

0 commit comments

Comments
 (0)