DATACMNS-539 - DefaultCrudMethods now detects delete(T t) methods.

The CRUD method detection now also discovers delete methods taking the domain type as argument.

Related ticket: DATAREST-319.
This commit is contained in:
Oliver Gierke
2014-07-15 10:37:16 +02:00
parent 750f33a587
commit 789f620af1
2 changed files with 21 additions and 2 deletions

View File

@@ -103,7 +103,8 @@ class DefaultCrudMethods implements CrudMethods {
@SuppressWarnings("unchecked")
private Method selectMostSuitableDeleteMethod(RepositoryMetadata metadata) {
for (Class<?> type : Arrays.asList(metadata.getIdType(), Serializable.class, Iterable.class)) {
for (Class<?> type : Arrays.asList(metadata.getDomainType(), metadata.getIdType(), Serializable.class,
Iterable.class)) {
Method candidate = findMethod(metadata.getRepositoryInterface(), DELETE, type);
if (candidate != null) {
return getMostSpecificMethod(candidate, metadata.getRepositoryInterface());