From ef42e7e1d3d474794834ea57ac6d38fbebc4d75a Mon Sep 17 00:00:00 2001 From: wonderfulrosemari Date: Sat, 28 Feb 2026 01:49:22 +0900 Subject: [PATCH] Polishing. Refine public API Javadoc descriptions. Closes #2602 Original pull request: #3465 Signed-off-by: wonderfulrosemari --- .../java/org/springframework/data/domain/Range.java | 2 +- .../data/repository/CrudRepository.java | 11 +++++------ .../data/repository/RepositoryDefinition.java | 5 +++-- .../repository/reactive/ReactiveCrudRepository.java | 5 +++-- .../repository/reactive/RxJava3CrudRepository.java | 5 +++-- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/main/java/org/springframework/data/domain/Range.java b/src/main/java/org/springframework/data/domain/Range.java index b01410b9a..4eb94295f 100644 --- a/src/main/java/org/springframework/data/domain/Range.java +++ b/src/main/java/org/springframework/data/domain/Range.java @@ -172,7 +172,7 @@ public final class Range { /** * Creates a new Range with the given value as sole member. * - * @param the type of the range.> + * @param the type of the range. * @param value must not be {@literal null}. * @return a range containing the given value. * @see Range#closed(Object, Object) diff --git a/src/main/java/org/springframework/data/repository/CrudRepository.java b/src/main/java/org/springframework/data/repository/CrudRepository.java index f9af20d33..db9a2e576 100644 --- a/src/main/java/org/springframework/data/repository/CrudRepository.java +++ b/src/main/java/org/springframework/data/repository/CrudRepository.java @@ -36,8 +36,8 @@ public interface CrudRepository extends Repository { * Saves a given entity. Use the returned instance for further operations as the save operation might have changed the * entity instance completely. * - * @param entity must not be {@literal null}. - * @return the saved entity; will never be {@literal null}. + * @param entity the entity to save, must not be {@literal null}. + * @return the saved entity. * @throws IllegalArgumentException in case the given {@literal entity} is {@literal null}. * @throws OptimisticLockingFailureException when the entity uses optimistic locking and has a version attribute with * a different value from that found in the persistence store. Also thrown if the entity is assumed to be @@ -49,8 +49,8 @@ public interface CrudRepository extends Repository { * Saves all given entities. * * @param entities must not be {@literal null} nor must it contain {@literal null}. - * @return the saved entities; will never be {@literal null}. The returned {@literal Iterable} will have the same size - * as the {@literal Iterable} passed as an argument. + * @return the saved entities. The returned {@literal Iterable} will have the same size as the {@literal Iterable} + * passed as an argument. * @throws IllegalArgumentException in case the given {@link Iterable entities} or one of its entities is * {@literal null}. * @throws OptimisticLockingFailureException when at least one entity uses optimistic locking and has a version @@ -92,8 +92,7 @@ public interface CrudRepository extends Repository { * Note that the order of elements in the result is not guaranteed. * * @param ids must not be {@literal null} nor contain any {@literal null} values. - * @return guaranteed to be not {@literal null}. The size can be equal or less than the number of given - * {@literal ids}. + * @return iterable of found entities. The size can be equal or less than the number of given {@literal ids}. * @throws IllegalArgumentException in case the given {@link Iterable ids} or one of its items is {@literal null}. */ Iterable findAllById(Iterable ids); diff --git a/src/main/java/org/springframework/data/repository/RepositoryDefinition.java b/src/main/java/org/springframework/data/repository/RepositoryDefinition.java index c9158682b..7f4ec388c 100644 --- a/src/main/java/org/springframework/data/repository/RepositoryDefinition.java +++ b/src/main/java/org/springframework/data/repository/RepositoryDefinition.java @@ -42,7 +42,7 @@ public @interface RepositoryDefinition { * The domain class the repository manages. Equivalent to the T type parameter in {@link Repository}. * * @see Repository - * @return + * @return the domain class managed by the repository. */ Class domainClass(); @@ -50,7 +50,8 @@ public @interface RepositoryDefinition { * The id class of the entity the repository manages. Equivalent to the ID type parameter in {@link Repository}. * * @see Repository - * @return + * @return the id class of the entity managed by the repository. */ Class idClass(); + } diff --git a/src/main/java/org/springframework/data/repository/reactive/ReactiveCrudRepository.java b/src/main/java/org/springframework/data/repository/reactive/ReactiveCrudRepository.java index 0424649f5..d16d63d0a 100644 --- a/src/main/java/org/springframework/data/repository/reactive/ReactiveCrudRepository.java +++ b/src/main/java/org/springframework/data/repository/reactive/ReactiveCrudRepository.java @@ -52,7 +52,7 @@ public interface ReactiveCrudRepository extends Repository { * Saves a given entity. Use the returned instance for further operations as the save operation might have changed the * entity instance completely. * - * @param entity must not be {@literal null}. + * @param entity the entity to save, must not be {@literal null}. * @return {@link Mono} emitting the saved entity. * @throws IllegalArgumentException in case the given {@literal entity} is {@literal null}. * @throws OptimisticLockingFailureException when the entity uses optimistic locking and has a version attribute with @@ -64,7 +64,7 @@ public interface ReactiveCrudRepository extends Repository { /** * Saves all given entities. * - * @param entities must not be {@literal null}. + * @param entities must not be {@literal null} nor must it contain {@literal null}. * @return {@link Flux} emitting the saved entities. * @throws IllegalArgumentException in case the given {@link Iterable entities} or one of its entities is * {@literal null}. @@ -242,4 +242,5 @@ public interface ReactiveCrudRepository extends Repository { * @return {@link Mono} signaling when operation has completed. */ Mono deleteAll(); + } diff --git a/src/main/java/org/springframework/data/repository/reactive/RxJava3CrudRepository.java b/src/main/java/org/springframework/data/repository/reactive/RxJava3CrudRepository.java index 2d4b21f98..edaffbf4d 100644 --- a/src/main/java/org/springframework/data/repository/reactive/RxJava3CrudRepository.java +++ b/src/main/java/org/springframework/data/repository/reactive/RxJava3CrudRepository.java @@ -52,7 +52,7 @@ public interface RxJava3CrudRepository extends Repository { * Saves a given entity. Use the returned instance for further operations as the save operation might have changed the * entity instance completely. * - * @param entity must not be {@literal null}. + * @param entity the entity to save, must not be {@literal null}. * @return {@link Single} emitting the saved entity. * @throws IllegalArgumentException in case the given {@literal entity} is {@literal null}. * @throws OptimisticLockingFailureException when the entity uses optimistic locking and has a version attribute with @@ -64,7 +64,7 @@ public interface RxJava3CrudRepository extends Repository { /** * Saves all given entities. * - * @param entities must not be {@literal null}. + * @param entities must not be {@literal null} nor must it contain {@literal null}. * @return {@link Flowable} emitting the saved entities. * @throws IllegalArgumentException in case the given {@link Iterable entities} or one of its entities is * {@literal null}. @@ -230,4 +230,5 @@ public interface RxJava3CrudRepository extends Repository { * @return {@link Completable} signaling when operation has completed. */ Completable deleteAll(); + }