mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-22 15:10:02 +00:00
#2663 - No effective change - Tidy Query interface with default methods
This commit is contained in:
1 parent
76b02ff56a
commit
4d21fbfcf8
3 files changed
+21
-44
No files matched your search
@@ -2,6 +2,7 @@ package io.ebean;
|
|||||||
|
|
||||||
import io.avaje.lang.NonNullApi;
|
import io.avaje.lang.NonNullApi;
|
||||||
import io.avaje.lang.Nullable;
|
import io.avaje.lang.Nullable;
|
||||||
|
|
||||||
import javax.persistence.NonUniqueResultException;
|
import javax.persistence.NonUniqueResultException;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
@@ -1372,18 +1373,9 @@ public interface Query<T> extends CancelableQuery {
|
|||||||
* optional asc and desc keywords representing ascending and descending order
|
* optional asc and desc keywords representing ascending and descending order
|
||||||
* respectively.
|
* respectively.
|
||||||
*/
|
*/
|
||||||
Query<T> order(String orderByClause);
|
default Query<T> order(String orderByClause) {
|
||||||
|
return orderBy(orderByClause);
|
||||||
/**
|
}
|
||||||
* Return the OrderBy so that you can append an ascending or descending
|
|
||||||
* property to the order by clause.
|
|
||||||
* <p>
|
|
||||||
* This will never return a null. If no order by clause exists then an 'empty'
|
|
||||||
* OrderBy object is returned.
|
|
||||||
* <p>
|
|
||||||
* This is the same as <code>orderBy()</code>
|
|
||||||
*/
|
|
||||||
OrderBy<T> order();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the OrderBy so that you can append an ascending or descending
|
* Return the OrderBy so that you can append an ascending or descending
|
||||||
@@ -1397,15 +1389,30 @@ public interface Query<T> extends CancelableQuery {
|
|||||||
OrderBy<T> orderBy();
|
OrderBy<T> orderBy();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set an OrderBy object to replace any existing OrderBy clause.
|
* Return the OrderBy so that you can append an ascending or descending
|
||||||
|
* property to the order by clause.
|
||||||
|
* <p>
|
||||||
|
* This will never return a null. If no order by clause exists then an 'empty'
|
||||||
|
* OrderBy object is returned.
|
||||||
|
* <p>
|
||||||
|
* This is the same as <code>orderBy()</code>
|
||||||
*/
|
*/
|
||||||
Query<T> setOrder(OrderBy<T> orderBy);
|
default OrderBy<T> order() {
|
||||||
|
return orderBy();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set an OrderBy object to replace any existing OrderBy clause.
|
* Set an OrderBy object to replace any existing OrderBy clause.
|
||||||
*/
|
*/
|
||||||
Query<T> setOrderBy(OrderBy<T> orderBy);
|
Query<T> setOrderBy(OrderBy<T> orderBy);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set an OrderBy object to replace any existing OrderBy clause.
|
||||||
|
*/
|
||||||
|
default Query<T> setOrder(OrderBy<T> orderBy) {
|
||||||
|
return setOrderBy(orderBy);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set whether this query uses DISTINCT.
|
* Set whether this query uses DISTINCT.
|
||||||
* <p>
|
* <p>
|
||||||
|
|||||||
@@ -432,26 +432,11 @@ final class DefaultFetchGroupQuery<T> implements SpiFetchGroupQuery<T>, SpiQuery
|
|||||||
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
|
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Query<T> order(String orderByClause) {
|
|
||||||
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public OrderBy<T> order() {
|
|
||||||
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OrderBy<T> orderBy() {
|
public OrderBy<T> orderBy() {
|
||||||
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
|
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Query<T> setOrder(OrderBy<T> orderBy) {
|
|
||||||
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Query<T> setOrderBy(OrderBy<T> orderBy) {
|
public Query<T> setOrderBy(OrderBy<T> orderBy) {
|
||||||
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
|
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
|
||||||
|
|||||||
@@ -1614,11 +1614,6 @@ public final class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OrderBy<T> orderBy() {
|
public OrderBy<T> orderBy() {
|
||||||
return order();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public OrderBy<T> order() {
|
|
||||||
if (orderBy == null) {
|
if (orderBy == null) {
|
||||||
orderBy = new OrderBy<>(this, null);
|
orderBy = new OrderBy<>(this, null);
|
||||||
}
|
}
|
||||||
@@ -1627,11 +1622,6 @@ public final class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Query<T> orderBy(String orderByClause) {
|
public Query<T> orderBy(String orderByClause) {
|
||||||
return order(orderByClause);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Query<T> order(String orderByClause) {
|
|
||||||
if (orderByClause == null || orderByClause.trim().isEmpty()) {
|
if (orderByClause == null || orderByClause.trim().isEmpty()) {
|
||||||
this.orderBy = null;
|
this.orderBy = null;
|
||||||
} else {
|
} else {
|
||||||
@@ -1642,11 +1632,6 @@ public final class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Query<T> setOrderBy(OrderBy<T> orderBy) {
|
public Query<T> setOrderBy(OrderBy<T> orderBy) {
|
||||||
return setOrder(orderBy);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Query<T> setOrder(OrderBy<T> orderBy) {
|
|
||||||
this.orderBy = orderBy;
|
this.orderBy = orderBy;
|
||||||
if (orderBy != null) {
|
if (orderBy != null) {
|
||||||
orderBy.setQuery(this);
|
orderBy.setQuery(this);
|
||||||
|
|||||||
Reference in new issue
Block a user