No effective change, move null check on orderBy to prior to parse

This commit is contained in:
rob bygrave
2018-07-15 13:55:51 +12:00
parent 0c41993ce7
commit 02b6ab0f74
2 changed files with 11 additions and 12 deletions
@@ -2,7 +2,6 @@ package io.ebeaninternal.server.query;
import io.ebean.OrderBy;
import io.ebean.OrderBy.Property;
import io.ebeaninternal.api.SpiQuery;
import io.ebeaninternal.server.deploy.BeanDescriptor;
import io.ebeaninternal.server.deploy.BeanProperty;
import io.ebeaninternal.server.deploy.BeanPropertyAssoc;
@@ -18,27 +17,22 @@ class CQueryOrderBy {
private final BeanDescriptor<?> desc;
private final SpiQuery<?> query;
private final OrderBy<?> orderBy;
/**
* Create the logical order by clause.
*/
public static String parse(BeanDescriptor<?> desc, SpiQuery<?> query) {
return new CQueryOrderBy(desc, query).parseInternal();
public static String parse(BeanDescriptor<?> desc, OrderBy<?> orderBy) {
return new CQueryOrderBy(desc, orderBy).parseInternal();
}
private CQueryOrderBy(BeanDescriptor<?> desc, SpiQuery<?> query) {
private CQueryOrderBy(BeanDescriptor<?> desc, OrderBy<?> orderBy) {
this.desc = desc;
this.query = query;
this.orderBy = orderBy;
}
private String parseInternal() {
OrderBy<?> orderBy = query.getOrderBy();
if (orderBy == null) {
return null;
}
StringBuilder sb = new StringBuilder();
List<Property> properties = orderBy.getProperties();
@@ -1,5 +1,6 @@
package io.ebeaninternal.server.query;
import io.ebean.OrderBy;
import io.ebeaninternal.api.BindParams;
import io.ebeaninternal.api.SpiExpressionList;
import io.ebeaninternal.api.SpiQuery;
@@ -329,7 +330,11 @@ public class CQueryPredicates {
private String parseOrderBy() {
return CQueryOrderBy.parse(request.getBeanDescriptor(), query);
OrderBy<?> orderBy = query.getOrderBy();
if (orderBy == null) {
return null;
}
return CQueryOrderBy.parse(request.getBeanDescriptor(), orderBy);
}
/**