DATAJPA-1238 - Polishing.

Formatting and Javadoc.
Changed cast from Boolean to boolean in order to avoid potential extra wrapper creation.

Original pull request: #270.
This commit is contained in:
Jens Schauder
2018-06-11 14:36:19 +02:00
parent b89c297f4e
commit 7d46a2d9c9

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2017 the original author or authors.
* Copyright 2008-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -599,16 +599,17 @@ public abstract class QueryUtils {
/**
* Returns whether the given {@code propertyPathModel} requires the creation of a join. This is the case if we find a
* non-optional association.
* optional association.
*
* @param propertyPathModel may be {@literal null}.
* @param forPluralAttribute
* @param forLeafProperty
* @return
* @param isPluralAttribute is the attribute of Collection type?
* @param isLeafProperty is this the final property navigated by a {@link PropertyPath}?
* @return wether an outer join is to be used for integrating this attribute in a query.
*/
private static boolean requiresJoin(@Nullable Bindable<?> propertyPathModel, boolean forPluralAttribute, boolean forLeafProperty) {
private static boolean requiresJoin(@Nullable Bindable<?> propertyPathModel, boolean isPluralAttribute,
boolean isLeafProperty) {
if (propertyPathModel == null && forPluralAttribute) {
if (propertyPathModel == null && isPluralAttribute) {
return true;
}
@@ -621,7 +622,8 @@ public abstract class QueryUtils {
if (!ASSOCIATION_TYPES.containsKey(attribute.getPersistentAttributeType())) {
return false;
}
if (forLeafProperty && !attribute.isCollection()) {
if (isLeafProperty && !attribute.isCollection()) {
return false;
}
@@ -638,7 +640,7 @@ public abstract class QueryUtils {
}
Annotation annotation = AnnotationUtils.getAnnotation((AnnotatedElement) member, associationAnnotation);
return annotation == null ? true : (Boolean) AnnotationUtils.getValue(annotation, "optional");
return annotation == null ? true : (boolean) AnnotationUtils.getValue(annotation, "optional");
}
static Expression<Object> toExpressionRecursively(Path<Object> path, PropertyPath property) {