DATAJPA-1295 - Improved readability.

This commit is contained in:
Сергей Цыпанов
2017-12-30 13:45:44 +02:00
committed by Oliver Gierke
parent bafd788f89
commit a731ab8d79
2 changed files with 4 additions and 5 deletions

View File

@@ -501,15 +501,14 @@ public abstract class QueryUtils {
*/
public static List<javax.persistence.criteria.Order> toOrders(Sort sort, From<?, ?> from, CriteriaBuilder cb) {
List<javax.persistence.criteria.Order> orders = new ArrayList<>();
if (sort.isUnsorted()) {
return orders;
return Collections.emptyList();
}
Assert.notNull(from, "From must not be null!");
Assert.notNull(cb, "CriteriaBuilder must not be null!");
List<javax.persistence.criteria.Order> orders = new ArrayList<>();
for (org.springframework.data.domain.Sort.Order order : sort) {
orders.add(toJpaOrder(order, from, cb));
}
@@ -654,7 +653,7 @@ public abstract class QueryUtils {
boolean sameName = join.getAttribute().getName().equals(attribute);
if (sameName && join.getJoinType().equals(JoinType.LEFT)) {
if (sameName && join.getJoinType() == JoinType.LEFT) {
return join;
}
}

View File

@@ -163,7 +163,6 @@ public class ClasspathScanningPersistenceUnitPostProcessor
String basePackagePathComponent = basePackage.replace('.', slash);
String path = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX + basePackagePathComponent + slash
+ mappingFileNamePattern;
Set<String> mappingFileUris = new HashSet<String>();
Resource[] scannedResources;
try {
@@ -172,6 +171,7 @@ public class ClasspathScanningPersistenceUnitPostProcessor
throw new IllegalStateException(String.format("Cannot load mapping files from path %s!", path), e);
}
Set<String> mappingFileUris = new HashSet<>();
for (Resource resource : scannedResources) {
try {
String resourcePath = getResourcePath(resource.getURI());