Browse Source

DATACMNS-988 - Polishing.

Improve JavaDoc. Remove findAll declarations in reactive sorting repositories as they are inherited with the same signature.

Original Pull Request: #194
pull/207/head
Mark Paluch 9 years ago committed by Christoph Strobl
parent
commit
3099125aa3
  1. 44
      src/main/java/org/springframework/data/repository/reactive/ReactiveCrudRepository.java
  2. 28
      src/main/java/org/springframework/data/repository/reactive/ReactiveSortingRepository.java
  3. 49
      src/main/java/org/springframework/data/repository/reactive/RxJava1CrudRepository.java
  4. 27
      src/main/java/org/springframework/data/repository/reactive/RxJava1SortingRepository.java

44
src/main/java/org/springframework/data/repository/reactive/ReactiveCrudRepository.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -40,8 +40,8 @@ public interface ReactiveCrudRepository<T, ID extends Serializable> extends Repo @@ -40,8 +40,8 @@ public interface ReactiveCrudRepository<T, ID extends Serializable> extends Repo
* Saves a given entity. Use the returned instance for further operations as the save operation might have changed the
* entity instance completely.
*
* @param entity
* @return the saved entity
* @param entity must not be {@literal null}.
* @return the saved entity.
*/
<S extends T> Mono<S> save(S entity);
@ -49,7 +49,7 @@ public interface ReactiveCrudRepository<T, ID extends Serializable> extends Repo @@ -49,7 +49,7 @@ public interface ReactiveCrudRepository<T, ID extends Serializable> extends Repo
* Saves all given entities.
*
* @param entities must not be {@literal null}.
* @return the saved entities
* @return the saved entities.
* @throws IllegalArgumentException in case the given entity is {@literal null}.
*/
<S extends T> Flux<S> save(Iterable<S> entities);
@ -58,7 +58,7 @@ public interface ReactiveCrudRepository<T, ID extends Serializable> extends Repo @@ -58,7 +58,7 @@ public interface ReactiveCrudRepository<T, ID extends Serializable> extends Repo
* Saves all given entities.
*
* @param entityStream must not be {@literal null}.
* @return the saved entities
* @return the saved entities.
* @throws IllegalArgumentException in case the given {@code Publisher} is {@literal null}.
*/
<S extends T> Flux<S> save(Publisher<S> entityStream);
@ -67,8 +67,8 @@ public interface ReactiveCrudRepository<T, ID extends Serializable> extends Repo @@ -67,8 +67,8 @@ public interface ReactiveCrudRepository<T, ID extends Serializable> extends Repo
* Retrieves an entity by its id.
*
* @param id must not be {@literal null}.
* @return the entity with the given id or {@literal null} if none found
* @throws IllegalArgumentException if {@code id} is {@literal null}
* @return the entity with the given id or {@link Mono#empty()} if none found.
* @throws IllegalArgumentException if {@code id} is {@literal null}.
*/
Mono<T> findOne(ID id);
@ -76,8 +76,8 @@ public interface ReactiveCrudRepository<T, ID extends Serializable> extends Repo @@ -76,8 +76,8 @@ public interface ReactiveCrudRepository<T, ID extends Serializable> extends Repo
* Retrieves an entity by its id supplied by a {@link Mono}.
*
* @param id must not be {@literal null}.
* @return the entity with the given id or {@literal null} if none found
* @throws IllegalArgumentException if {@code id} is {@literal null}
* @return the entity with the given id or {@link Mono#empty()} if none found.
* @throws IllegalArgumentException if {@code id} is {@literal null}.
*/
Mono<T> findOne(Mono<ID> id);
@ -85,8 +85,8 @@ public interface ReactiveCrudRepository<T, ID extends Serializable> extends Repo @@ -85,8 +85,8 @@ public interface ReactiveCrudRepository<T, ID extends Serializable> extends Repo
* Returns whether an entity with the given id exists.
*
* @param id must not be {@literal null}.
* @return true if an entity with the given id exists, {@literal false} otherwise
* @throws IllegalArgumentException if {@code id} is {@literal null}
* @return {@literal true} if an entity with the given id exists, {@literal false} otherwise.
* @throws IllegalArgumentException if {@code id} is {@literal null}.
*/
Mono<Boolean> exists(ID id);
@ -94,7 +94,7 @@ public interface ReactiveCrudRepository<T, ID extends Serializable> extends Repo @@ -94,7 +94,7 @@ public interface ReactiveCrudRepository<T, ID extends Serializable> extends Repo
* Returns whether an entity with the given id exists supplied by a {@link Mono}.
*
* @param id must not be {@literal null}.
* @return true if an entity with the given id exists, {@literal false} otherwise
* @return {@literal true} if an entity with the given id exists, {@literal false} otherwise
* @throws IllegalArgumentException if {@code id} is {@literal null}
*/
Mono<Boolean> exists(Mono<ID> id);
@ -102,30 +102,30 @@ public interface ReactiveCrudRepository<T, ID extends Serializable> extends Repo @@ -102,30 +102,30 @@ public interface ReactiveCrudRepository<T, ID extends Serializable> extends Repo
/**
* Returns all instances of the type.
*
* @return all entities
* @return all entities.
*/
Flux<T> findAll();
/**
* Returns all instances of the type with the given IDs.
*
* @param ids
* @return
* @param ids must not be {@literal null}.
* @return the found entities.
*/
Flux<T> findAll(Iterable<ID> ids);
/**
* Returns all instances of the type with the given IDs.
*
* @param idStream
* @return
* @param idStream must not be {@literal null}.
* @return the found entities.
*/
Flux<T> findAll(Publisher<ID> idStream);
/**
* Returns the number of entities available.
*
* @return the number of entities
* @return the number of entities.
*/
Mono<Long> count();
@ -133,14 +133,14 @@ public interface ReactiveCrudRepository<T, ID extends Serializable> extends Repo @@ -133,14 +133,14 @@ public interface ReactiveCrudRepository<T, ID extends Serializable> extends Repo
* Deletes the entity with the given id.
*
* @param id must not be {@literal null}.
* @throws IllegalArgumentException in case the given {@code id} is {@literal null}
* @throws IllegalArgumentException in case the given {@code id} is {@literal null}.
*/
Mono<Void> delete(ID id);
/**
* Deletes a given entity.
*
* @param entity
* @param entity must not be {@literal null}.
* @throws IllegalArgumentException in case the given entity is {@literal null}.
*/
Mono<Void> delete(T entity);
@ -148,7 +148,7 @@ public interface ReactiveCrudRepository<T, ID extends Serializable> extends Repo @@ -148,7 +148,7 @@ public interface ReactiveCrudRepository<T, ID extends Serializable> extends Repo
/**
* Deletes the given entities.
*
* @param entities
* @param entities must not be {@literal null}.
* @throws IllegalArgumentException in case the given {@link Iterable} is {@literal null}.
*/
Mono<Void> delete(Iterable<? extends T> entities);
@ -156,7 +156,7 @@ public interface ReactiveCrudRepository<T, ID extends Serializable> extends Repo @@ -156,7 +156,7 @@ public interface ReactiveCrudRepository<T, ID extends Serializable> extends Repo
/**
* Deletes the given entities.
*
* @param entityStream
* @param entityStream must not be {@literal null}.
* @throws IllegalArgumentException in case the given {@link Publisher} is {@literal null}.
*/
Mono<Void> delete(Publisher<? extends T> entityStream);

28
src/main/java/org/springframework/data/repository/reactive/ReactiveSortingRepository.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -17,7 +17,6 @@ package org.springframework.data.repository.reactive; @@ -17,7 +17,6 @@ package org.springframework.data.repository.reactive;
import java.io.Serializable;
import org.reactivestreams.Publisher;
import org.springframework.data.domain.Sort;
import org.springframework.data.repository.NoRepositoryBean;
@ -37,32 +36,11 @@ import reactor.core.publisher.Mono; @@ -37,32 +36,11 @@ import reactor.core.publisher.Mono;
@NoRepositoryBean
public interface ReactiveSortingRepository<T, ID extends Serializable> extends ReactiveCrudRepository<T, ID> {
/*
* (non-Javadoc)
* @see org.springframework.data.repository.reactive.ReactiveCrudRepository#findAll()
*/
@Override
Flux<T> findAll();
/*
* (non-Javadoc)
* @see org.springframework.data.repository.reactive.ReactiveCrudRepository#findAll(java.lang.Iterable)
*/
@Override
Flux<T> findAll(Iterable<ID> ids);
/*
* (non-Javadoc)
* @see org.springframework.data.repository.reactive.ReactiveCrudRepository#findAll(org.reactivestreams.Publisher)
*/
@Override
Flux<T> findAll(Publisher<ID> idStream);
/**
* Returns all entities sorted by the given options.
*
* @param sort
* @return all entities sorted by the given options
* @param sort must not be {@literal null}.
* @return all entities sorted by the given options.
*/
Flux<T> findAll(Sort sort);
}

49
src/main/java/org/springframework/data/repository/reactive/RxJava1CrudRepository.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -17,7 +17,6 @@ package org.springframework.data.repository.reactive; @@ -17,7 +17,6 @@ package org.springframework.data.repository.reactive;
import java.io.Serializable;
import org.reactivestreams.Publisher;
import org.springframework.data.repository.NoRepositoryBean;
import org.springframework.data.repository.Repository;
@ -41,8 +40,8 @@ public interface RxJava1CrudRepository<T, ID extends Serializable> extends Repos @@ -41,8 +40,8 @@ public interface RxJava1CrudRepository<T, ID extends Serializable> extends Repos
* Saves a given entity. Use the returned instance for further operations as the save operation might have changed the
* entity instance completely.
*
* @param entity
* @return the saved entity
* @param entity must not be {@literal null}.
* @return the saved entity.
*/
<S extends T> Single<S> save(S entity);
@ -50,7 +49,7 @@ public interface RxJava1CrudRepository<T, ID extends Serializable> extends Repos @@ -50,7 +49,7 @@ public interface RxJava1CrudRepository<T, ID extends Serializable> extends Repos
* Saves all given entities.
*
* @param entities must not be {@literal null}.
* @return the saved entities
* @return the saved entities.
* @throws IllegalArgumentException in case the given entity is {@literal null}.
*/
<S extends T> Observable<S> save(Iterable<S> entities);
@ -59,7 +58,7 @@ public interface RxJava1CrudRepository<T, ID extends Serializable> extends Repos @@ -59,7 +58,7 @@ public interface RxJava1CrudRepository<T, ID extends Serializable> extends Repos
* Saves all given entities.
*
* @param entityStream must not be {@literal null}.
* @return the saved entities
* @return the saved entities.
* @throws IllegalArgumentException in case the given {@code Publisher} is {@literal null}.
*/
<S extends T> Observable<S> save(Observable<S> entityStream);
@ -68,8 +67,8 @@ public interface RxJava1CrudRepository<T, ID extends Serializable> extends Repos @@ -68,8 +67,8 @@ public interface RxJava1CrudRepository<T, ID extends Serializable> extends Repos
* Retrieves an entity by its id.
*
* @param id must not be {@literal null}.
* @return the entity with the given id or {@literal null} if none found
* @throws IllegalArgumentException if {@code id} is {@literal null}
* @return the entity with the given id or {@link Observable#empty()} if none found.
* @throws IllegalArgumentException if {@code id} is {@literal null}.
*/
Observable<T> findOne(ID id);
@ -77,8 +76,8 @@ public interface RxJava1CrudRepository<T, ID extends Serializable> extends Repos @@ -77,8 +76,8 @@ public interface RxJava1CrudRepository<T, ID extends Serializable> extends Repos
* Retrieves an entity by its id supplied by a {@link Single}.
*
* @param id must not be {@literal null}.
* @return the entity with the given id or {@literal null} if none found
* @throws IllegalArgumentException if {@code id} is {@literal null}
* @return the entity with the given id or {@link Observable#empty()} if none found.
* @throws IllegalArgumentException if {@code id} is {@literal null}.
*/
Observable<T> findOne(Single<ID> id);
@ -86,8 +85,8 @@ public interface RxJava1CrudRepository<T, ID extends Serializable> extends Repos @@ -86,8 +85,8 @@ public interface RxJava1CrudRepository<T, ID extends Serializable> extends Repos
* Returns whether an entity with the given id exists.
*
* @param id must not be {@literal null}.
* @return true if an entity with the given id exists, {@literal false} otherwise
* @throws IllegalArgumentException if {@code id} is {@literal null}
* @return {@literal true} if an entity with the given id exists, {@literal false} otherwise.
* @throws IllegalArgumentException if {@code id} is {@literal null}.
*/
Single<Boolean> exists(ID id);
@ -95,38 +94,38 @@ public interface RxJava1CrudRepository<T, ID extends Serializable> extends Repos @@ -95,38 +94,38 @@ public interface RxJava1CrudRepository<T, ID extends Serializable> extends Repos
* Returns whether an entity with the given id exists supplied by a {@link Single}.
*
* @param id must not be {@literal null}.
* @return true if an entity with the given id exists, {@literal false} otherwise
* @throws IllegalArgumentException if {@code id} is {@literal null}
* @return {@literal true} if an entity with the given id exists, {@literal false} otherwise.
* @throws IllegalArgumentException if {@code id} is {@literal null}.
*/
Single<Boolean> exists(Single<ID> id);
/**
* Returns all instances of the type.
*
* @return all entities
* @return all entities.
*/
Observable<T> findAll();
/**
* Returns all instances of the type with the given IDs.
*
* @param ids
* @return
* @param ids must not be {@literal null}.
* @return the found entities.
*/
Observable<T> findAll(Iterable<ID> ids);
/**
* Returns all instances of the type with the given IDs.
*
* @param idStream
* @return
* @param idStream must not be {@literal null}.
* @return the found entities.
*/
Observable<T> findAll(Observable<ID> idStream);
/**
* Returns the number of entities available.
*
* @return the number of entities
* @return the number of entities.
*/
Single<Long> count();
@ -134,14 +133,14 @@ public interface RxJava1CrudRepository<T, ID extends Serializable> extends Repos @@ -134,14 +133,14 @@ public interface RxJava1CrudRepository<T, ID extends Serializable> extends Repos
* Deletes the entity with the given id.
*
* @param id must not be {@literal null}.
* @throws IllegalArgumentException in case the given {@code id} is {@literal null}
* @throws IllegalArgumentException in case the given {@code id} is {@literal null}.
*/
Completable delete(ID id);
/**
* Deletes a given entity.
*
* @param entity
* @param entity must not be {@literal null}.
* @throws IllegalArgumentException in case the given entity is {@literal null}.
*/
Completable delete(T entity);
@ -149,7 +148,7 @@ public interface RxJava1CrudRepository<T, ID extends Serializable> extends Repos @@ -149,7 +148,7 @@ public interface RxJava1CrudRepository<T, ID extends Serializable> extends Repos
/**
* Deletes the given entities.
*
* @param entities
* @param entities must not be {@literal null}.
* @throws IllegalArgumentException in case the given {@link Iterable} is {@literal null}.
*/
Completable delete(Iterable<? extends T> entities);
@ -157,8 +156,8 @@ public interface RxJava1CrudRepository<T, ID extends Serializable> extends Repos @@ -157,8 +156,8 @@ public interface RxJava1CrudRepository<T, ID extends Serializable> extends Repos
/**
* Deletes the given entities.
*
* @param entityStream
* @throws IllegalArgumentException in case the given {@link Publisher} is {@literal null}.
* @param entityStream must not be {@literal null}.
* @throws IllegalArgumentException in case the given {@link Observable} is {@literal null}.
*/
Completable delete(Observable<? extends T> entityStream);

27
src/main/java/org/springframework/data/repository/reactive/RxJava1SortingRepository.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -37,32 +37,11 @@ import rx.Single; @@ -37,32 +37,11 @@ import rx.Single;
@NoRepositoryBean
public interface RxJava1SortingRepository<T, ID extends Serializable> extends RxJava1CrudRepository<T, ID> {
/*
* (non-Javadoc)
* @see org.springframework.data.repository.reactive.ReactiveCrudRepository#findAll()
*/
@Override
Observable<T> findAll();
/*
* (non-Javadoc)
* @see org.springframework.data.repository.reactive.ReactiveCrudRepository#findAll(java.lang.Iterable)
*/
@Override
Observable<T> findAll(Iterable<ID> ids);
/*
* (non-Javadoc)
* @see org.springframework.data.repository.reactive.ReactiveCrudRepository#findAll(org.reactivestreams.Publisher)
*/
@Override
Observable<T> findAll(Observable<ID> idStream);
/**
* Returns all entities sorted by the given options.
*
* @param sort
* @return all entities sorted by the given options
* @param sort must not be {@literal null}.
* @return all entities sorted by the given options.
*/
Observable<T> findAll(Sort sort);
}

Loading…
Cancel
Save