From fd32f9fd62e8e333d5d13a7daba68a17f0f6a59e Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Wed, 16 May 2012 16:52:18 +0200 Subject: [PATCH] DATAJPA-212 - Polished JavaDoc. --- .../JpaMetamodelEntityInformation.java | 3 +- .../support/QueryDslJpaRepository.java | 56 +++++++------------ .../support/QueryDslRepositorySupport.java | 8 +-- ...hScanningPersistenceUnitPostProcessor.java | 2 +- 4 files changed, 27 insertions(+), 42 deletions(-) diff --git a/src/main/java/org/springframework/data/jpa/repository/support/JpaMetamodelEntityInformation.java b/src/main/java/org/springframework/data/jpa/repository/support/JpaMetamodelEntityInformation.java index 805951645..1f8a7d654 100644 --- a/src/main/java/org/springframework/data/jpa/repository/support/JpaMetamodelEntityInformation.java +++ b/src/main/java/org/springframework/data/jpa/repository/support/JpaMetamodelEntityInformation.java @@ -35,7 +35,8 @@ import org.springframework.util.Assert; import org.springframework.util.ReflectionUtils; /** - * Implementation of {@link EntityInformation} that uses JPA {@link Metamodel} to find the domain class' id field. + * Implementation of {@link org.springframework.data.repository.core.EntityInformation} that uses JPA {@link Metamodel} + * to find the domain class' id field. * * @author Oliver Gierke */ diff --git a/src/main/java/org/springframework/data/jpa/repository/support/QueryDslJpaRepository.java b/src/main/java/org/springframework/data/jpa/repository/support/QueryDslJpaRepository.java index 2eeeeba92..b25d0c5b2 100644 --- a/src/main/java/org/springframework/data/jpa/repository/support/QueryDslJpaRepository.java +++ b/src/main/java/org/springframework/data/jpa/repository/support/QueryDslJpaRepository.java @@ -56,72 +56,59 @@ public class QueryDslJpaRepository extends SimpleJpa * Creates a new {@link QueryDslJpaRepository} from the given domain class and {@link EntityManager}. This will use * the {@link SimpleEntityPathResolver} to translate the given domain class into an {@link EntityPath}. * - * @param domainClass - * @param entityManager + * @param entityInformation must not be {@literal null}. + * @param entityManager must not be {@literal null}. */ - public QueryDslJpaRepository(JpaEntityInformation entityMetadata, EntityManager entityManager) { + public QueryDslJpaRepository(JpaEntityInformation entityInformation, EntityManager entityManager) { - this(entityMetadata, entityManager, DEFAULT_ENTITY_PATH_RESOLVER); + this(entityInformation, entityManager, DEFAULT_ENTITY_PATH_RESOLVER); } /** * Creates a new {@link QueryDslJpaRepository} from the given domain class and {@link EntityManager} and uses the * given {@link EntityPathResolver} to translate the domain class into an {@link EntityPath}. * - * @param domainClass - * @param entityManager - * @param resolver + * @param entityInformation must not be {@literal null}. + * @param entityManager must not be {@literal null}. + * @param resolver must not be {@literal null}. */ - public QueryDslJpaRepository(JpaEntityInformation entityMetadata, EntityManager entityManager, + public QueryDslJpaRepository(JpaEntityInformation entityInformation, EntityManager entityManager, EntityPathResolver resolver) { - super(entityMetadata, entityManager); + super(entityInformation, entityManager); this.em = entityManager; - this.path = resolver.createPath(entityMetadata.getJavaType()); + this.path = resolver.createPath(entityInformation.getJavaType()); this.builder = new PathBuilder(path.getType(), path.getMetadata()); this.provider = PersistenceProvider.fromEntityManager(entityManager); } /* * (non-Javadoc) - * - * @see org.springframework.data.jpa.repository.querydsl. - * QueryDslSpecificationExecutor#findOne(com.mysema.query.types.Predicate) + * @see org.springframework.data.querydsl.QueryDslPredicateExecutor#findOne(com.mysema.query.types.Predicate) */ public T findOne(Predicate predicate) { - return createQuery(predicate).uniqueResult(path); } /* * (non-Javadoc) - * - * @see org.springframework.data.jpa.repository.querydsl. - * QueryDslSpecificationExecutor#findAll(com.mysema.query.types.Predicate) + * @see org.springframework.data.querydsl.QueryDslPredicateExecutor#findAll(com.mysema.query.types.Predicate) */ public List findAll(Predicate predicate) { - return createQuery(predicate).list(path); } /* * (non-Javadoc) - * - * @see org.springframework.data.jpa.repository.querydsl. - * QueryDslSpecificationExecutor#findAll(com.mysema.query.types.Predicate, - * com.mysema.query.types.OrderSpecifier[]) + * @see org.springframework.data.querydsl.QueryDslPredicateExecutor#findAll(com.mysema.query.types.Predicate, com.mysema.query.types.OrderSpecifier[]) */ public List findAll(Predicate predicate, OrderSpecifier... orders) { - return createQuery(predicate).orderBy(orders).list(path); } /* * (non-Javadoc) - * - * @see org.springframework.data.jpa.repository.querydsl. - * QueryDslSpecificationExecutor#findAll(com.mysema.query.types.Predicate, - * org.springframework.data.domain.Pageable) + * @see org.springframework.data.querydsl.QueryDslPredicateExecutor#findAll(com.mysema.query.types.Predicate, org.springframework.data.domain.Pageable) */ public Page findAll(Predicate predicate, Pageable pageable) { @@ -133,12 +120,9 @@ public class QueryDslJpaRepository extends SimpleJpa /* * (non-Javadoc) - * - * @see org.springframework.data.jpa.repository.querydsl. - * QueryDslSpecificationExecutor#count(com.mysema.query.types.Predicate) + * @see org.springframework.data.querydsl.QueryDslPredicateExecutor#count(com.mysema.query.types.Predicate) */ public long count(Predicate predicate) { - return createQuery(predicate).count(); } @@ -146,7 +130,7 @@ public class QueryDslJpaRepository extends SimpleJpa * Creates a new {@link JPQLQuery} for the given {@link Predicate}. * * @param predicate - * @return + * @return the Querydsl {@link JPQLQuery}. */ protected JPQLQuery createQuery(Predicate... predicate) { return QuerydslUtils.createQueryInstance(em, provider).from(path).where(predicate); @@ -155,9 +139,9 @@ public class QueryDslJpaRepository extends SimpleJpa /** * Applies the given {@link Pageable} to the given {@link JPQLQuery}. * - * @param query + * @param query must not be {@literal null}. * @param pageable - * @return + * @return the Querydsl {@link JPQLQuery}. */ protected JPQLQuery applyPagination(JPQLQuery query, Pageable pageable) { @@ -174,9 +158,9 @@ public class QueryDslJpaRepository extends SimpleJpa /** * Applies sorting to the given {@link JPQLQuery}. * - * @param query + * @param query must not be {@literal null}. * @param sort - * @return + * @return the Querydsl {@link JPQLQuery} */ protected JPQLQuery applySorting(JPQLQuery query, Sort sort) { diff --git a/src/main/java/org/springframework/data/jpa/repository/support/QueryDslRepositorySupport.java b/src/main/java/org/springframework/data/jpa/repository/support/QueryDslRepositorySupport.java index 6b744fcd1..782e5139a 100644 --- a/src/main/java/org/springframework/data/jpa/repository/support/QueryDslRepositorySupport.java +++ b/src/main/java/org/springframework/data/jpa/repository/support/QueryDslRepositorySupport.java @@ -76,7 +76,7 @@ public abstract class QueryDslRepositorySupport { /** * Returns a fresh {@link JPQLQuery}. * - * @return + * @return the Querydsl {@link JPQLQuery}. */ protected JPQLQuery from(EntityPath... paths) { return QuerydslUtils.createQueryInstance(entityManager, provider).from(paths); @@ -86,7 +86,7 @@ public abstract class QueryDslRepositorySupport { * Returns a fresh {@link DeleteClause}. * * @param path - * @return + * @return the Querydsl {@link DeleteClause}. */ protected DeleteClause delete(EntityPath path) { @@ -97,7 +97,7 @@ public abstract class QueryDslRepositorySupport { * Returns a fresh {@link UpdateClause}. * * @param path - * @return + * @return the Querydsl {@link UpdateClause}. */ protected UpdateClause update(EntityPath path) { @@ -109,7 +109,7 @@ public abstract class QueryDslRepositorySupport { * * @param * @param type - * @return + * @return the Querdsl {@link PathBuilder}. */ protected PathBuilder getBuilder(Class type) { diff --git a/src/main/java/org/springframework/data/jpa/support/ClasspathScanningPersistenceUnitPostProcessor.java b/src/main/java/org/springframework/data/jpa/support/ClasspathScanningPersistenceUnitPostProcessor.java index bc7c908a4..8239cc833 100644 --- a/src/main/java/org/springframework/data/jpa/support/ClasspathScanningPersistenceUnitPostProcessor.java +++ b/src/main/java/org/springframework/data/jpa/support/ClasspathScanningPersistenceUnitPostProcessor.java @@ -68,7 +68,7 @@ public class ClasspathScanningPersistenceUnitPostProcessor implements Persistenc * Configures the file name pattern JPA entity mapping files shall scanned from the classpath. Lookup will use the * configured base package as root. * - * @param mappingFileNamePattern must not be {@literal null} or empty. + * @param mappingFilePattern must not be {@literal null} or empty. */ public void setMappingFileNamePattern(String mappingFilePattern) { Assert.hasText(mappingFilePattern);