Browse Source

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.
pull/2/head
Oliver Gierke 15 years ago
parent
commit
413341a1aa
  1. 11
      spring-data-commons-core/src/main/java/org/springframework/data/repository/support/RepositoryFactorySupport.java

11
spring-data-commons-core/src/main/java/org/springframework/data/repository/support/RepositoryFactorySupport.java

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

Loading…
Cancel
Save