DATAJPA-212 - Polished JavaDoc.

This commit is contained in:
Oliver Gierke
2012-05-16 16:52:18 +02:00
parent dd57d5cce8
commit fd32f9fd62
4 changed files with 27 additions and 42 deletions

View File

@@ -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
*/

View File

@@ -56,72 +56,59 @@ public class QueryDslJpaRepository<T, ID extends Serializable> 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<T, ID> entityMetadata, EntityManager entityManager) {
public QueryDslJpaRepository(JpaEntityInformation<T, ID> 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<T, ID> entityMetadata, EntityManager entityManager,
public QueryDslJpaRepository(JpaEntityInformation<T, ID> 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<T>(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<T> 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<T> 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<T> findAll(Predicate predicate, Pageable pageable) {
@@ -133,12 +120,9 @@ public class QueryDslJpaRepository<T, ID extends Serializable> 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<T, ID extends Serializable> 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<T, ID extends Serializable> 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<T, ID extends Serializable> 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) {

View File

@@ -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<JPADeleteClause> 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<JPAUpdateClause> update(EntityPath<?> path) {
@@ -109,7 +109,7 @@ public abstract class QueryDslRepositorySupport {
*
* @param <T>
* @param type
* @return
* @return the Querdsl {@link PathBuilder}.
*/
protected <T> PathBuilder<T> getBuilder(Class<T> type) {

View File

@@ -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);