mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-06-24 04:52:12 +00:00
Nullability annotation cleanup.
This commit is contained in:
parent
33973ec839
commit
d2b3ba94f6
@ -192,8 +192,7 @@ public String getProperty() {
|
|||||||
|
|
||||||
This annotation can be set on a String property of an entity.
|
This annotation can be set on a String property of an entity.
|
||||||
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.
|
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.
|
||||||
After an entity is persisted, for example with a call to `ElasticsearchOperations.save(T entity)`, the entity
|
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.
|
||||||
returned from that call will contain the name of the index that an entity was saved to in that property.
|
|
||||||
This is useful when the index name is dynamically set by a bean, or when writing to a write alias.
|
This is useful when the index name is dynamically set by a bean, or when writing to a write alias.
|
||||||
|
|
||||||
Putting some value into such a property does not set the index into which an entity is stored!
|
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
|
|||||||
@Configuration
|
@Configuration
|
||||||
public class Config extends ElasticsearchConfiguration {
|
public class Config extends ElasticsearchConfiguration {
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
@Override
|
||||||
public ClientConfiguration clientConfiguration() {
|
public ClientConfiguration clientConfiguration() {
|
||||||
return ClientConfiguration.builder() //
|
return ClientConfiguration.builder() //
|
||||||
|
@ -57,7 +57,6 @@ import org.springframework.data.elasticsearch.support.VersionInfo;
|
|||||||
import org.springframework.data.mapping.callback.EntityCallbacks;
|
import org.springframework.data.mapping.callback.EntityCallbacks;
|
||||||
import org.springframework.data.mapping.context.MappingContext;
|
import org.springframework.data.mapping.context.MappingContext;
|
||||||
import org.springframework.data.util.Streamable;
|
import org.springframework.data.util.Streamable;
|
||||||
import org.springframework.lang.NonNull;
|
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
@ -779,8 +778,7 @@ public abstract class AbstractElasticsearchTemplate implements ElasticsearchOper
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected interface SearchDocumentResponseCallback<T> {
|
protected interface SearchDocumentResponseCallback<T> {
|
||||||
@NonNull
|
T doWith(SearchDocumentResponse response);
|
||||||
T doWith(@NonNull SearchDocumentResponse response);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class ReadSearchDocumentResponseCallback<T> implements SearchDocumentResponseCallback<SearchHits<T>> {
|
protected class ReadSearchDocumentResponseCallback<T> implements SearchDocumentResponseCallback<SearchHits<T>> {
|
||||||
@ -795,7 +793,6 @@ public abstract class AbstractElasticsearchTemplate implements ElasticsearchOper
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
@Override
|
||||||
public SearchHits<T> doWith(SearchDocumentResponse response) {
|
public SearchHits<T> doWith(SearchDocumentResponse response) {
|
||||||
List<T> entities = response.getSearchDocuments().stream().map(delegate::doWith).collect(Collectors.toList());
|
List<T> entities = response.getSearchDocuments().stream().map(delegate::doWith).collect(Collectors.toList());
|
||||||
@ -816,7 +813,6 @@ public abstract class AbstractElasticsearchTemplate implements ElasticsearchOper
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
@Override
|
||||||
public SearchScrollHits<T> doWith(SearchDocumentResponse response) {
|
public SearchScrollHits<T> doWith(SearchDocumentResponse response) {
|
||||||
List<T> entities = response.getSearchDocuments().stream().map(delegate::doWith).collect(Collectors.toList());
|
List<T> entities = response.getSearchDocuments().stream().map(delegate::doWith).collect(Collectors.toList());
|
||||||
|
@ -55,7 +55,6 @@ import org.springframework.data.elasticsearch.core.script.Script;
|
|||||||
import org.springframework.data.elasticsearch.core.suggest.response.Suggest;
|
import org.springframework.data.elasticsearch.core.suggest.response.Suggest;
|
||||||
import org.springframework.data.elasticsearch.support.VersionInfo;
|
import org.springframework.data.elasticsearch.support.VersionInfo;
|
||||||
import org.springframework.data.mapping.callback.ReactiveEntityCallbacks;
|
import org.springframework.data.mapping.callback.ReactiveEntityCallbacks;
|
||||||
import org.springframework.lang.NonNull;
|
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
@ -575,7 +574,6 @@ abstract public class AbstractReactiveElasticsearchTemplate
|
|||||||
* @param document the document to convert
|
* @param document the document to convert
|
||||||
* @return a Mono of the entity
|
* @return a Mono of the entity
|
||||||
*/
|
*/
|
||||||
@NonNull
|
|
||||||
Mono<T> toEntity(@Nullable Document document);
|
Mono<T> toEntity(@Nullable Document document);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -593,7 +591,6 @@ abstract public class AbstractReactiveElasticsearchTemplate
|
|||||||
this.index = index;
|
this.index = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
|
||||||
public Mono<T> toEntity(@Nullable Document document) {
|
public Mono<T> toEntity(@Nullable Document document) {
|
||||||
if (document == null) {
|
if (document == null) {
|
||||||
return Mono.empty();
|
return Mono.empty();
|
||||||
|
@ -31,7 +31,6 @@ import org.springframework.data.elasticsearch.client.elc.ElasticsearchConfigurat
|
|||||||
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
|
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
|
||||||
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
|
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
|
||||||
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories;
|
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories;
|
||||||
import org.springframework.lang.NonNull;
|
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||||
@ -50,7 +49,6 @@ public class ElasticsearchConfigurationELCTests {
|
|||||||
@EnableElasticsearchRepositories(basePackages = { "org.springframework.data.elasticsearch.config.configuration" },
|
@EnableElasticsearchRepositories(basePackages = { "org.springframework.data.elasticsearch.config.configuration" },
|
||||||
considerNestedRepositories = true)
|
considerNestedRepositories = true)
|
||||||
static class Config extends ElasticsearchConfiguration {
|
static class Config extends ElasticsearchConfiguration {
|
||||||
@NonNull
|
|
||||||
@Override
|
@Override
|
||||||
public ClientConfiguration clientConfiguration() {
|
public ClientConfiguration clientConfiguration() {
|
||||||
return ClientConfiguration.builder() //
|
return ClientConfiguration.builder() //
|
||||||
|
@ -29,7 +29,6 @@ import org.springframework.data.elasticsearch.client.elc.ReactiveElasticsearchCo
|
|||||||
import org.springframework.data.elasticsearch.core.ReactiveElasticsearchOperations;
|
import org.springframework.data.elasticsearch.core.ReactiveElasticsearchOperations;
|
||||||
import org.springframework.data.elasticsearch.repository.ReactiveElasticsearchRepository;
|
import org.springframework.data.elasticsearch.repository.ReactiveElasticsearchRepository;
|
||||||
import org.springframework.data.elasticsearch.repository.config.EnableReactiveElasticsearchRepositories;
|
import org.springframework.data.elasticsearch.repository.config.EnableReactiveElasticsearchRepositories;
|
||||||
import org.springframework.lang.NonNull;
|
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||||
@ -48,7 +47,6 @@ public class ReactiveElasticsearchConfigurationELCTests {
|
|||||||
considerNestedRepositories = true)
|
considerNestedRepositories = true)
|
||||||
static class Config extends ReactiveElasticsearchConfiguration {
|
static class Config extends ReactiveElasticsearchConfiguration {
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
@Override
|
||||||
public ClientConfiguration clientConfiguration() {
|
public ClientConfiguration clientConfiguration() {
|
||||||
return ClientConfiguration.builder() //
|
return ClientConfiguration.builder() //
|
||||||
|
Loading…
x
Reference in New Issue
Block a user