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

@@ -132,6 +132,16 @@ public class DefaultCrudMethodsUnitTests {
assertSaveMethodOn(RepositoryWithCustomSave.class, RepositoryWithCustomSave.class.getMethod("save", Domain.class));
}
/**
* @see DATACMNS-539
*/
@Test
public void detectsOverriddenDeleteMethodForEntity() throws Exception {
assertDeleteMethodOn(RepositoryWithDeleteMethodForEntityOverloaded.class,
RepositoryWithDeleteMethodForEntityOverloaded.class.getMethod("delete", Domain.class));
}
private static CrudMethods getMethodsFor(Class<?> repositoryInterface) {
RepositoryMetadata metadata = new DefaultRepositoryMetadata(repositoryInterface);
@@ -250,8 +260,16 @@ public class DefaultCrudMethodsUnitTests {
Domain save(Serializable entity);
void delete(Domain o);
void delete(String o);
Domain findOne(Domain o);
}
/**
* @see DATACMNS-539
*/
interface RepositoryWithDeleteMethodForEntityOverloaded extends CrudRepository<Domain, Long> {
void delete(Domain entity);
}
}