From 8b76c04afdb15cc2f20a271c31cb5a4b98bd97d9 Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Mon, 29 Nov 2010 23:02:30 +0100 Subject: [PATCH] Applied generics to JpaQueryLookupStrategy after changes in Spring Data Core. --- .../jpa/repository/query/JpaQueryLookupStrategy.java | 10 +++++----- .../jpa/repository/support/JpaRepositoryFactory.java | 8 ++++---- .../repository/support/JpaRepositoryFactoryBean.java | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/springframework/data/jpa/repository/query/JpaQueryLookupStrategy.java b/src/main/java/org/springframework/data/jpa/repository/query/JpaQueryLookupStrategy.java index dc8e9779c..62b71a9af 100644 --- a/src/main/java/org/springframework/data/jpa/repository/query/JpaQueryLookupStrategy.java +++ b/src/main/java/org/springframework/data/jpa/repository/query/JpaQueryLookupStrategy.java @@ -21,7 +21,6 @@ import javax.persistence.EntityManager; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.QueryLookupStrategy; import org.springframework.data.repository.query.QueryLookupStrategy.Key; -import org.springframework.data.repository.query.QueryMethod; import org.springframework.data.repository.query.RepositoryQuery; @@ -39,7 +38,7 @@ public class JpaQueryLookupStrategy { * @author Oliver Gierke */ private static abstract class AbstractQueryLookupStrategy implements - QueryLookupStrategy { + QueryLookupStrategy { private EntityManager em; @@ -57,9 +56,9 @@ public class JpaQueryLookupStrategy { * org.springframework.data.jpa.repository.query.QueryLookupStrategy * #resolveQuery(org.springframework.data.repository.query.QueryMethod) */ - public final RepositoryQuery resolveQuery(QueryMethod method) { + public final RepositoryQuery resolveQuery(JpaQueryMethod method) { - return resolveQuery((JpaQueryMethod) method, em); + return resolveQuery(method, em); } @@ -173,7 +172,8 @@ public class JpaQueryLookupStrategy { * @param key * @return */ - public static QueryLookupStrategy create(EntityManager em, Key key) { + public static QueryLookupStrategy create(EntityManager em, + Key key) { if (key == null) { return new CreateIfNotFoundQueryLookupStrategy(em); diff --git a/src/main/java/org/springframework/data/jpa/repository/support/JpaRepositoryFactory.java b/src/main/java/org/springframework/data/jpa/repository/support/JpaRepositoryFactory.java index 4b473200f..fe99d530b 100644 --- a/src/main/java/org/springframework/data/jpa/repository/support/JpaRepositoryFactory.java +++ b/src/main/java/org/springframework/data/jpa/repository/support/JpaRepositoryFactory.java @@ -10,7 +10,6 @@ import org.springframework.data.jpa.repository.query.JpaQueryMethod; import org.springframework.data.jpa.repository.query.QueryExtractor; import org.springframework.data.repository.query.QueryLookupStrategy; import org.springframework.data.repository.query.QueryLookupStrategy.Key; -import org.springframework.data.repository.query.QueryMethod; import org.springframework.data.repository.support.RepositoryFactorySupport; import org.springframework.data.repository.support.RepositorySupport; import org.springframework.util.Assert; @@ -21,7 +20,8 @@ import org.springframework.util.Assert; * * @author Oliver Gierke */ -public class JpaRepositoryFactory extends RepositoryFactorySupport { +public class JpaRepositoryFactory extends + RepositoryFactorySupport { private final EntityManager entityManager; @@ -79,7 +79,7 @@ public class JpaRepositoryFactory extends RepositoryFactorySupport { * getQueryMethod(java.lang.reflect.Method) */ @Override - protected QueryMethod getQueryMethod(Method method) { + protected JpaQueryMethod getQueryMethod(Method method) { QueryExtractor extractor = PersistenceProvider.fromEntityManager(entityManager); @@ -111,7 +111,7 @@ public class JpaRepositoryFactory extends RepositoryFactorySupport { * (org.springframework.data.repository.query.QueryLookupStrategy.Key) */ @Override - protected QueryLookupStrategy getQueryLookupStrategy(Key key) { + protected QueryLookupStrategy getQueryLookupStrategy(Key key) { return JpaQueryLookupStrategy.create(entityManager, key); } diff --git a/src/main/java/org/springframework/data/jpa/repository/support/JpaRepositoryFactoryBean.java b/src/main/java/org/springframework/data/jpa/repository/support/JpaRepositoryFactoryBean.java index 8368bbad0..7e1655f16 100644 --- a/src/main/java/org/springframework/data/jpa/repository/support/JpaRepositoryFactoryBean.java +++ b/src/main/java/org/springframework/data/jpa/repository/support/JpaRepositoryFactoryBean.java @@ -71,7 +71,7 @@ public class JpaRepositoryFactoryBean> extends * #createRepositoryFactory() */ @Override - protected RepositoryFactorySupport createRepositoryFactory() { + protected RepositoryFactorySupport createRepositoryFactory() { return createRepositoryFactory(entityManager); } @@ -83,7 +83,7 @@ public class JpaRepositoryFactoryBean> extends * @param entityManager * @return */ - protected RepositoryFactorySupport createRepositoryFactory( + protected RepositoryFactorySupport createRepositoryFactory( EntityManager entityManager) { return new JpaRepositoryFactory(entityManager);