DATACMNS-944 - Moved to more consistent naming scheme for CrudRepository methods.

We now follow a more consistent naming scheme for the methods in repository that are driven by the following guidelines:

* Methods referring to an identifier now all end on …ById(…).
* Methods taking or returning a collection are named …All(…)

That results in the following renames:

* findOne(…) -> findById(…)
* save(Iterable) -> saveAll(Iterable)
* findAll(Iterable<ID>) -> findAllById(…)
* delete(ID) -> deleteById(ID)
* delete(Iterable<T>) -> deleteAll(Iterable<T>)
* exists() -> existsById(…)

As a side-effect of that, we can now drop the Serializable requirement for identifiers.

Updated CRUD method detection to use the new naming scheme and moved the code to Java 8 streams and Optional. Adapted RepositoryInvoker API to reflect method name changes as well.
This commit is contained in:
Oliver Gierke
2017-04-28 15:28:28 +02:00
parent 382c912111
commit 727ab8384c
55 changed files with 324 additions and 397 deletions

View File

@@ -86,11 +86,11 @@ public class QuerydslRepositoryInvokerAdapterUnitTests {
adapter.hasSaveMethod();
verify(delegate, times(1)).hasSaveMethod();
adapter.invokeDelete(any(Serializable.class));
verify(delegate, times(1)).invokeDelete(any());
adapter.invokeDeleteById(any(Serializable.class));
verify(delegate, times(1)).invokeDeleteById(any());
adapter.invokeFindOne(any(Serializable.class));
verify(delegate, times(1)).invokeFindOne(any());
adapter.invokeFindById(any(Serializable.class));
verify(delegate, times(1)).invokeFindById(any());
adapter.invokeQueryMethod(any(), any(), any(), any());