Extended callback methods to take repository interface into account when creating repository backing object.

As factory implementations might have to inspect the actual repository interface to select a concrete repository implementation, we have to hand the interface to the methods returning the class and returning the actual object.
This commit is contained in:
Oliver Gierke
2010-12-29 12:54:28 +01:00
parent 03bc52d137
commit 413341a1aa

View File

@@ -117,7 +117,8 @@ public abstract class RepositoryFactorySupport {
validate(repositoryInterface, customImplementation);
Class<?> domainClass = getDomainClass(repositoryInterface);
RepositorySupport<?, ?> target = getTargetRepository(domainClass);
RepositorySupport<?, ?> target =
getTargetRepository(domainClass, repositoryInterface);
// Create proxy
ProxyFactory result = new ProxyFactory();
@@ -144,7 +145,7 @@ public abstract class RepositoryFactorySupport {
* @return
*/
protected abstract <T, ID extends Serializable> RepositorySupport<T, ID> getTargetRepository(
Class<T> domainClass);
Class<T> domainClass, Class<?> repositoryInterface);
/**
@@ -153,7 +154,8 @@ public abstract class RepositoryFactorySupport {
* @return
*/
@SuppressWarnings("rawtypes")
protected abstract Class<? extends RepositorySupport> getRepositoryClass();
protected abstract Class<? extends RepositorySupport> getRepositoryClass(
Class<?> repositoryInterface);
/**
@@ -238,7 +240,8 @@ public abstract class RepositoryFactorySupport {
}
result =
getBaseClassMethodFor(method, getRepositoryClass(),
getBaseClassMethodFor(method,
getRepositoryClass(repositoryInterface),
repositoryInterface);
methodCache.put(method, result);