diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/TQRootBean.java b/ebean-querybean/src/main/java/io/ebean/typequery/TQRootBean.java
index 4584bea31..113dd16ec 100644
--- a/ebean-querybean/src/main/java/io/ebean/typequery/TQRootBean.java
+++ b/ebean-querybean/src/main/java/io/ebean/typequery/TQRootBean.java
@@ -147,7 +147,7 @@ public abstract class TQRootBean
* This is typically a Postgres and Oracle only option at this stage.
*/
- public R forUpdateNoWait() {
+ public final R forUpdateNoWait() {
query.forUpdateNoWait();
return root;
}
@@ -803,7 +803,7 @@ public abstract class TQRootBean
* If the query result is in cache then by default this same instance is * returned. In this sense it should be treated as a read only object graph. - *
*/ - public R setUseCache(boolean useCache) { + public final R setUseCache(boolean useCache) { query.setUseCache(useCache); return root; } @@ -1026,13 +1025,11 @@ public abstract class TQRootBean- * By default findList() with natural keys will not use the bean cache. In that + * By default, findList() with natural keys will not use the bean cache. In that * case we need to explicitly use the bean cache. - *
*/ - public R setBeanCacheMode(CacheMode beanCacheMode) { + public final R setBeanCacheMode(CacheMode beanCacheMode) { query.setBeanCacheMode(beanCacheMode); return root; } @@ -1041,9 +1038,8 @@ public abstract class TQRootBean* When setting this you may also consider disabling lazy loading. - *
*/ - public R setUseDocStore(boolean useDocStore) { + public final R setUseDocStore(boolean useDocStore) { query.setUseDocStore(useDocStore); return root; } @@ -1052,9 +1048,8 @@ public abstract class TQRootBean* That is, once the object graph is returned further lazy loading is disabled. - *
*/ - public R setDisableLazyLoading(boolean disableLazyLoading) { + public final R setDisableLazyLoading(boolean disableLazyLoading) { query.setDisableLazyLoading(disableLazyLoading); return root; } @@ -1065,9 +1060,8 @@ public abstract class TQRootBean* Validate the query checking the where and orderBy expression paths to confirm if * they represent valid properties or paths for the given bean type. - *
*/ - public Set*
{@code
*
@@ -1135,7 +1126,7 @@ public abstract class TQRootBean {
*
* }
*/
- public R raw(String rawExpression) {
+ public final R raw(String rawExpression) {
peekExprList().raw(rawExpression);
return root;
}
@@ -1145,14 +1136,12 @@ public abstract class TQRootBean* The raw expression should contain the same number of ? as there are * parameters. - *
** When properties in the clause are fully qualified as table-column names * then they are not translated. logical property name names (not fully * qualified) will still be translated to their physical name. - *
*/ - public R raw(String rawExpression, Object... bindValues) { + public final R raw(String rawExpression, Object... bindValues) { peekExprList().raw(rawExpression, bindValues); return root; } @@ -1217,7 +1206,7 @@ public abstract class TQRootBean* Use endNot() or endJunction() to stop added to NOT and 'pop' to the parent expression list. - *
*/ - public R not() { + public final R not() { pushExprList(peekExprList().not()); return root; } @@ -1411,12 +1399,10 @@ public abstract class TQRootBean* This automatically makes this query a document store query. - *
** Use endJunction() to stop added to MUST and 'pop' to the parent expression list. - *
*/ - public R must() { + public final R must() { pushExprList(peekExprList().must()); return root; } @@ -1425,12 +1411,10 @@ public abstract class TQRootBean* This automatically makes this query a document store query. - *
** Use endJunction() to stop added to MUST NOT and 'pop' to the parent expression list. - *
*/ - public R mustNot() { + public final R mustNot() { return pushExprList(peekExprList().mustNot()); } @@ -1438,19 +1422,17 @@ public abstract class TQRootBean* This automatically makes this query a document store query. - *
** Use endJunction() to stop added to SHOULD and 'pop' to the parent expression list. - *
*/ - public R should() { + public final R should() { return pushExprList(peekExprList().should()); } /** * End a list of expressions added by 'OR'. */ - public R endJunction() { + public final R endJunction() { if (textMode) { textStack.pop(); } else { @@ -1462,21 +1444,21 @@ public abstract class TQRootBean* For queries against the normal database (not the doc store) this has no effect. - *
** This is intended for use with Document Store / ElasticSearch where expressions can be put into either * the "query" section or the "filter" section of the query. Full text expressions like MATCH are in the * "query" section but many expression can be in either - expressions after the where() are put into the * "filter" section which means that they don't add to the relevance and are also cache-able. - *
*/ - public R where() { + public final R where() { textMode = false; return root; } @@ -1513,13 +1493,11 @@ public abstract class TQRootBean* This automatically makes the query a document store query. - *
** For ElasticSearch expressions added to 'text' go into the ElasticSearch 'query context' * and expressions added to 'where' go into the ElasticSearch 'filter context'. - *
*/ - public R text() { + public final R text() { textMode = true; return root; } @@ -1528,9 +1506,8 @@ public abstract class TQRootBean* This automatically makes the query a document store query. - *
*/ - public R multiMatch(String query, MultiMatch multiMatch) { + public final R multiMatch(String query, MultiMatch multiMatch) { peekExprList().multiMatch(query, multiMatch); return root; } @@ -1539,9 +1516,8 @@ public abstract class TQRootBean* This automatically makes the query a document store query. - *
*/ - public R multiMatch(String query, String... properties) { + public final R multiMatch(String query, String... properties) { peekExprList().multiMatch(query, properties); return root; } @@ -1550,9 +1526,8 @@ public abstract class TQRootBean* This automatically makes the query a document store query. - *
*/ - public R textCommonTerms(String query, TextCommonTerms options) { + public final R textCommonTerms(String query, TextCommonTerms options) { peekExprList().textCommonTerms(query, options); return root; } @@ -1561,9 +1536,8 @@ public abstract class TQRootBean* This automatically makes the query a document store query. - *
*/ - public R textSimple(String query, TextSimple options) { + public final R textSimple(String query, TextSimple options) { peekExprList().textSimple(query, options); return root; } @@ -1572,9 +1546,8 @@ public abstract class TQRootBean* This automatically makes the query a document store query. - *
*/ - public R textQueryString(String query, TextQueryString options) { + public final R textQueryString(String query, TextQueryString options) { peekExprList().textQueryString(query, options); return root; } @@ -1582,7 +1555,7 @@ public abstract class TQRootBean{@code
@@ -1639,7 +1611,7 @@ public abstract class TQRootBean {
*
* @return True if the query finds a matching row in the database
*/
- public boolean exists() {
+ public final boolean exists() {
return query.exists();
}
@@ -1649,11 +1621,9 @@ public abstract class TQRootBean {
*
* If more than 1 row is found for this query then a PersistenceException is
* thrown.
- *
*
* This is useful when your predicates dictate that your query should only
* return 0 or 1 results.
- *
*
*
{@code
*
@@ -1665,10 +1635,8 @@ public abstract class TQRootBean {
* ...
* }
*
- *
* It is also useful with finding objects by their id when you want to specify
* further join information to optimise the query.
- *
*
*
{@code
*
@@ -1685,14 +1653,14 @@ public abstract class TQRootBean {
* }
*/
@Nullable
- public T findOne() {
+ public final T findOne() {
return query.findOne();
}
/**
* Execute the query returning an optional bean.
*/
- public Optional findOneOrEmpty() {
+ public final Optional findOneOrEmpty() {
return query.findOneOrEmpty();
}
@@ -1700,7 +1668,6 @@ public abstract class TQRootBean {
* Execute the query returning the list of objects.
*
* This query will execute against the EbeanServer that was used to create it.
- *
*
*
{@code
*
@@ -1713,7 +1680,7 @@ public abstract class TQRootBean {
*
* @see Query#findList()
*/
- public List findList() {
+ public final List findList() {
return query.findList();
}
@@ -1736,7 +1703,7 @@ public abstract class TQRootBean {
*
* }
*/
- public Stream findStream() {
+ public final Stream findStream() {
return query.findStream();
}
@@ -1744,7 +1711,6 @@ public abstract class TQRootBean {
* Execute the query returning the set of objects.
*
* This query will execute against the EbeanServer that was used to create it.
- *
*
*
{@code
*
@@ -1757,7 +1723,7 @@ public abstract class TQRootBean {
*
* @see Query#findSet()
*/
- public Set findSet() {
+ public final Set findSet() {
return query.findSet();
}
@@ -1765,11 +1731,10 @@ public abstract class TQRootBean {
* Execute the query returning the list of Id's.
*
* This query will execute against the EbeanServer that was used to create it.
- *
*
* @see Query#findIds()
*/
- public List findIds() {
+ public final List findIds() {
return query.findIds();
}
@@ -1777,11 +1742,9 @@ public abstract class TQRootBean {
* Execute the query returning a map of the objects.
*
* This query will execute against the EbeanServer that was used to create it.
- *
*
* You can use setMapKey() or asMapKey() to specify the property to be used as keys
* on the map. If one is not specified then the id property is used.
- *
*
*
{@code
*
@@ -1794,7 +1757,7 @@ public abstract class TQRootBean {
*
* @see Query#findMap()
*/
- public Map findMap() {
+ public final Map findMap() {
return query.findMap();
}
@@ -1804,15 +1767,12 @@ public abstract class TQRootBean {
* Note that findIterate (and findEach and findEachWhile) uses a "per graph"
* persistence context scope and adjusts jdbc fetch buffer size for large
* queries. As such it is better to use findList for small queries.
- *
*
* Remember that with {@link QueryIterator} you must call {@link QueryIterator#close()}
* when you have finished iterating the results (typically in a finally block).
- *
*
* findEach() and findEachWhile() are preferred to findIterate() as they ensure
* the jdbc statement and resultSet are closed at the end of the iteration.
- *
*
* This query will execute against the EbeanServer that was used to create it.
*
@@ -1834,7 +1794,7 @@ public abstract class TQRootBean {
*
* }
*/
- public QueryIterator findIterate() {
+ public final QueryIterator findIterate() {
return query.findIterate();
}
@@ -1854,7 +1814,7 @@ public abstract class TQRootBean {
*
* @return the list of values for the selected property
*/
- public List findSingleAttributeList() {
+ public final List findSingleAttributeList() {
return query.findSingleAttributeList();
}
@@ -1874,7 +1834,7 @@ public abstract class TQRootBean {
* @return a single value or null for the selected property
*/
@Nullable
- public A findSingleAttribute() {
+ public final A findSingleAttribute() {
return query.findSingleAttribute();
}
@@ -1895,8 +1855,7 @@ public abstract class TQRootBean {
*
* @return an optional value for the selected property
*/
- @Nullable
- public Optional findSingleAttributeOrEmpty() {
+ public final Optional findSingleAttributeOrEmpty() {
return query.findSingleAttributeOrEmpty();
}
@@ -1934,7 +1893,7 @@ public abstract class TQRootBean {
*
* @param consumer the consumer used to process the queried beans.
*/
- public void findEach(Consumer consumer) {
+ public final void findEach(Consumer consumer) {
query.findEach(consumer);
}
@@ -1951,7 +1910,7 @@ public abstract class TQRootBean {
* @param batch The number of beans processed in the batch
* @param consumer Process the batch of beans
*/
- public void findEach(int batch, Consumer> consumer) {
+ public final void findEach(int batch, Consumer> consumer) {
query.findEach(batch, consumer);
}
@@ -1980,7 +1939,7 @@ public abstract class TQRootBean {
*
* @param consumer the consumer used to process the queried beans.
*/
- public void findEachWhile(Predicate consumer) {
+ public final void findEachWhile(Predicate consumer) {
query.findEachWhile(consumer);
}
@@ -1989,9 +1948,8 @@ public abstract class TQRootBean {
*
* Generally this query is expected to be a find by id or unique predicates query.
* It will execute the query against the history returning the versions of the bean.
- *
*/
- public List> findVersions() {
+ public final List> findVersions() {
return query.findVersions();
}
@@ -2000,9 +1958,8 @@ public abstract class TQRootBean {
*
* Generally this query is expected to be a find by id or unique predicates query.
* It will execute the query against the history returning the versions of the bean.
- *
*/
- public List> findVersionsBetween(Timestamp start, Timestamp end) {
+ public final List> findVersionsBetween(Timestamp start, Timestamp end) {
return query.findVersionsBetween(start, end);
}
@@ -2010,9 +1967,8 @@ public abstract class TQRootBean {
* Return the count of entities this query should return.
*
* This is the number of 'top level' or 'root level' entities.
- *
*/
- public int findCount() {
+ public final int findCount() {
return query.findCount();
}
@@ -2022,11 +1978,10 @@ public abstract class TQRootBean {
* This returns a Future object which can be used to cancel, check the
* execution status (isDone etc) and get the value (with or without a
* timeout).
- *
*
* @return a Future object for the row count query
*/
- public FutureRowCount findFutureCount() {
+ public final FutureRowCount findFutureCount() {
return query.findFutureCount();
}
@@ -2036,11 +1991,10 @@ public abstract class TQRootBean {
* This returns a Future object which can be used to cancel, check the
* execution status (isDone etc) and get the value (with or without a
* timeout).
- *
*
* @return a Future object for the list of Id's
*/
- public FutureIds findFutureIds() {
+ public final FutureIds findFutureIds() {
return query.findFutureIds();
}
@@ -2049,11 +2003,10 @@ public abstract class TQRootBean {
*
* This query will execute in it's own PersistenceContext and using its own transaction.
* What that means is that it will not share any bean instances with other queries.
- *
*
* @return a Future object for the list result of the query
*/
- public FutureList findFutureList() {
+ public final FutureList findFutureList() {
return query.findFutureList();
}
@@ -2062,11 +2015,9 @@ public abstract class TQRootBean {
*
* The benefit of using this over findList() is that it provides functionality to get the
* total row count etc.
- *
*
* If maxRows is not set on the query prior to calling findPagedList() then a
* PersistenceException is thrown.
- *
*
*
{@code
*
@@ -2086,7 +2037,7 @@ public abstract class TQRootBean {
*
* @return The PagedList
*/
- public PagedList findPagedList() {
+ public final PagedList findPagedList() {
return query.findPagedList();
}
@@ -2096,11 +2047,10 @@ public abstract class TQRootBean {
*
* Note that if the query includes joins then the generated delete statement may not be
* optimal depending on the database platform.
- *
*
* @return the number of beans/rows that were deleted.
*/
- public int delete() {
+ public final int delete() {
return query.delete();
}
@@ -2109,23 +2059,22 @@ public abstract class TQRootBean {
*
* This is only available after the query has been executed and provided only
* for informational purposes.
- *
*/
- public String getGeneratedSql() {
+ public final String getGeneratedSql() {
return query.getGeneratedSql();
}
/**
* Return the type of beans being queried.
*/
- public Class getBeanType() {
+ public final Class getBeanType() {
return query.getBeanType();
}
/**
* Return the expression list that has been built for this query.
*/
- public ExpressionList getExpressionList() {
+ public final ExpressionList getExpressionList() {
return query.where();
}
@@ -2147,7 +2096,7 @@ public abstract class TQRootBean {
*
* }
*/
- public R having() {
+ public final R having() {
if (whereStack == null) {
whereStack = new ArrayStack<>();
}
@@ -2162,7 +2111,6 @@ public abstract class TQRootBean {
*
* Note that after this we no longer have the query bean so typically we use this right
* at the end of the query.
- *
*
* {@code
*
@@ -2183,14 +2131,14 @@ public abstract class TQRootBean {
*
* }
*/
- public ExpressionList havingClause() {
+ public final ExpressionList havingClause() {
return query.having();
}
/**
* Return the current expression list that expressions should be added to.
*/
- protected ExpressionList peekExprList() {
+ protected final ExpressionList peekExprList() {
if (textMode) {
// return the current text expression list
return _peekText();
@@ -2203,7 +2151,7 @@ public abstract class TQRootBean {
return whereStack.peek();
}
- protected ExpressionList _peekText() {
+ protected final ExpressionList _peekText() {
if (textStack == null) {
textStack = new ArrayStack<>();
// empty so push on the queries base expression list