Merge pull request #2796 from ebean-orm/feature/final-mods-querybeans

Add missing final modifier on methods of query bean types
This commit is contained in:
Rob Bygrave
2022-08-18 16:55:43 +12:00
committed by GitHub
11 changed files with 58 additions and 59 deletions
+3 -3
View File
@@ -6,7 +6,7 @@
<parent>
<artifactId>ebean-parent</artifactId>
<groupId>io.ebean</groupId>
<version>13.8.0-SNAPSHOT</version>
<version>13.8.1-SNAPSHOT</version>
</parent>
<artifactId>ebean-kotlin</artifactId>
@@ -28,7 +28,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.8.0-SNAPSHOT</version>
<version>13.8.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
@@ -50,7 +50,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-test</artifactId>
<version>13.8.0-SNAPSHOT</version>
<version>13.8.1-SNAPSHOT</version>
<scope>test</scope>
</dependency>
@@ -32,7 +32,7 @@ public abstract class PBaseDate<R, D extends Comparable> extends PBaseCompareabl
* @param value the equal to bind value
* @return the root query bean instance
*/
public R after(D value) {
public final R after(D value) {
expr().gt(_name, value);
return _root;
}
@@ -43,7 +43,7 @@ public abstract class PBaseDate<R, D extends Comparable> extends PBaseCompareabl
* @param value the equal to bind value
* @return the root query bean instance
*/
public R before(D value) {
public final R before(D value) {
expr().lt(_name, value);
return _root;
}
@@ -34,7 +34,7 @@ public abstract class PBaseNumber<R,T extends Comparable> extends PBaseCompareab
* @param value the equal to bind value
* @return the root query bean instance
*/
public R equalTo(int value) {
public final R equalTo(int value) {
expr().eq(_name, value);
return _root;
}
@@ -45,7 +45,7 @@ public abstract class PBaseNumber<R,T extends Comparable> extends PBaseCompareab
* @param value the equal to bind value
* @return the root query bean instance
*/
public R greaterThan(int value) {
public final R greaterThan(int value) {
expr().gt(_name, value);
return _root;
}
@@ -56,7 +56,7 @@ public abstract class PBaseNumber<R,T extends Comparable> extends PBaseCompareab
* @param value the equal to bind value
* @return the root query bean instance
*/
public R lessThan(int value) {
public final R lessThan(int value) {
expr().lt(_name, value);
return _root;
}
@@ -68,7 +68,7 @@ public abstract class PBaseNumber<R,T extends Comparable> extends PBaseCompareab
* @param value the equal to bind value
* @return the root query bean instance
*/
public R eq(int value) {
public final R eq(int value) {
expr().eq(_name, value);
return _root;
}
@@ -79,7 +79,7 @@ public abstract class PBaseNumber<R,T extends Comparable> extends PBaseCompareab
* @param value the equal to bind value
* @return the root query bean instance
*/
public R gt(int value) {
public final R gt(int value) {
expr().gt(_name, value);
return _root;
}
@@ -90,7 +90,7 @@ public abstract class PBaseNumber<R,T extends Comparable> extends PBaseCompareab
* @param value the equal to bind value
* @return the root query bean instance
*/
public R lt(int value) {
public final R lt(int value) {
expr().lt(_name, value);
return _root;
}
@@ -102,7 +102,7 @@ public abstract class PBaseNumber<R,T extends Comparable> extends PBaseCompareab
* @param upper the upper bind value
* @return the root query bean instance
*/
public R between(int lower, int upper) {
public final R between(int lower, int upper) {
expr().between(_name, lower, upper);
return _root;
}
@@ -54,7 +54,7 @@ public abstract class PBaseString<R,T> extends PBaseCompareable<R, String> {
* @param value the equal to bind value
* @return the root query bean instance
*/
public R ieq(String value) {
public final R ieq(String value) {
expr().ieq(_name, value);
return _root;
}
@@ -65,7 +65,7 @@ public abstract class PBaseString<R,T> extends PBaseCompareable<R, String> {
* @param value the equal to bind value
* @return the root query bean instance
*/
public R iequalTo(String value) {
public final R iequalTo(String value) {
expr().ieq(_name, value);
return _root;
}
@@ -76,7 +76,7 @@ public abstract class PBaseString<R,T> extends PBaseCompareable<R, String> {
* @param value the equal to bind value
* @return the root query bean instance
*/
public R like(String value) {
public final R like(String value) {
expr().like(_name, value);
return _root;
}
@@ -87,7 +87,7 @@ public abstract class PBaseString<R,T> extends PBaseCompareable<R, String> {
* @param value the equal to bind value
* @return the root query bean instance
*/
public R startsWith(String value) {
public final R startsWith(String value) {
expr().startsWith(_name, value);
return _root;
}
@@ -98,7 +98,7 @@ public abstract class PBaseString<R,T> extends PBaseCompareable<R, String> {
* @param value the equal to bind value
* @return the root query bean instance
*/
public R endsWith(String value) {
public final R endsWith(String value) {
expr().endsWith(_name, value);
return _root;
}
@@ -109,7 +109,7 @@ public abstract class PBaseString<R,T> extends PBaseCompareable<R, String> {
* @param value the equal to bind value
* @return the root query bean instance
*/
public R contains(String value) {
public final R contains(String value) {
expr().contains(_name, value);
return _root;
}
@@ -120,7 +120,7 @@ public abstract class PBaseString<R,T> extends PBaseCompareable<R, String> {
* @param value the equal to bind value
* @return the root query bean instance
*/
public R ilike(String value) {
public final R ilike(String value) {
expr().ilike(_name, value);
return _root;
}
@@ -131,7 +131,7 @@ public abstract class PBaseString<R,T> extends PBaseCompareable<R, String> {
* @param value the equal to bind value
* @return the root query bean instance
*/
public R istartsWith(String value) {
public final R istartsWith(String value) {
expr().istartsWith(_name, value);
return _root;
}
@@ -142,7 +142,7 @@ public abstract class PBaseString<R,T> extends PBaseCompareable<R, String> {
* @param value the equal to bind value
* @return the root query bean instance
*/
public R iendsWith(String value) {
public final R iendsWith(String value) {
expr().iendsWith(_name, value);
return _root;
}
@@ -153,7 +153,7 @@ public abstract class PBaseString<R,T> extends PBaseCompareable<R, String> {
* @param value the equal to bind value
* @return the root query bean instance
*/
public R icontains(String value) {
public final R icontains(String value) {
expr().icontains(_name, value);
return _root;
}
@@ -166,7 +166,7 @@ public abstract class PBaseString<R,T> extends PBaseCompareable<R, String> {
*
* @param value the match expression
*/
public R match(String value) {
public final R match(String value) {
expr().match(_name, value);
return _root;
}
@@ -5,7 +5,8 @@ package io.ebean.typequery;
*
* @param <R> the root query bean type
*/
public class PByteArray<R> extends PBaseValueEqual<R, byte[]> {
public final class PByteArray<R> extends PBaseValueEqual<R, byte[]> {
/**
* Construct with a property name and root instance.
*
@@ -7,7 +7,6 @@ import java.sql.Date;
*
* @param <R> the root query bean type
*/
public final class PSqlDate<R> extends PBaseDate<R,Date> {
/**
@@ -44,7 +44,7 @@ public abstract class TQAssocBean<T, R> extends TQProperty<R> {
/**
* Eagerly fetch this association fetching all the properties.
*/
public R fetch() {
public final R fetch() {
((TQRootBean) _root).query().fetch(_name);
return _root;
}
@@ -52,7 +52,7 @@ public abstract class TQAssocBean<T, R> extends TQProperty<R> {
/**
* Eagerly fetch this association using a "query join".
*/
public R fetchQuery() {
public final R fetchQuery() {
((TQRootBean) _root).query().fetchQuery(_name);
return _root;
}
@@ -61,7 +61,7 @@ public abstract class TQAssocBean<T, R> extends TQProperty<R> {
* Eagerly fetch this association using L2 bean cache.
* Cache misses are populated via fetchQuery().
*/
public R fetchCache() {
public final R fetchCache() {
((TQRootBean) _root).query().fetchCache(_name);
return _root;
}
@@ -69,7 +69,7 @@ public abstract class TQAssocBean<T, R> extends TQProperty<R> {
/**
* Use lazy loading for fetching this association.
*/
public R fetchLazy() {
public final R fetchLazy() {
((TQRootBean) _root).query().fetchLazy(_name);
return _root;
}
@@ -77,7 +77,7 @@ public abstract class TQAssocBean<T, R> extends TQProperty<R> {
/**
* Eagerly fetch this association with the properties specified.
*/
public R fetch(String properties) {
public final R fetch(String properties) {
((TQRootBean) _root).query().fetch(_name, properties);
return _root;
}
@@ -85,7 +85,7 @@ public abstract class TQAssocBean<T, R> extends TQProperty<R> {
/**
* Eagerly fetch this association using a "query join" with the properties specified.
*/
public R fetchQuery(String properties) {
public final R fetchQuery(String properties) {
((TQRootBean) _root).query().fetchQuery(_name, properties);
return _root;
}
@@ -94,7 +94,7 @@ public abstract class TQAssocBean<T, R> extends TQProperty<R> {
* Eagerly fetch this association using L2 cache with the properties specified.
* Cache misses are populated via fetchQuery().
*/
public R fetchCache(String properties) {
public final R fetchCache(String properties) {
((TQRootBean) _root).query().fetchCache(_name, properties);
return _root;
}
@@ -103,7 +103,7 @@ public abstract class TQAssocBean<T, R> extends TQProperty<R> {
* Deprecated in favor of fetch().
*/
@Deprecated
public R fetchAll() {
public final R fetchAll() {
return fetch();
}
@@ -140,7 +140,7 @@ public abstract class TQAssocBean<T, R> extends TQProperty<R> {
}
@SafeVarargs
private final R fetchWithProperties(FetchConfig config, TQProperty<?>... props) {
private R fetchWithProperties(FetchConfig config, TQProperty<?>... props) {
spiQuery().fetchProperties(_name, properties(props), config);
return _root;
}
@@ -148,21 +148,21 @@ public abstract class TQAssocBean<T, R> extends TQProperty<R> {
/**
* Fetch using the nested FetchGroup.
*/
public R fetch(FetchGroup<T> nestedGroup) {
public final R fetch(FetchGroup<T> nestedGroup) {
return fetchNested(nestedGroup, FETCH_DEFAULT);
}
/**
* Fetch query using the nested FetchGroup.
*/
public R fetchQuery(FetchGroup<T> nestedGroup) {
public final R fetchQuery(FetchGroup<T> nestedGroup) {
return fetchNested(nestedGroup, FETCH_QUERY);
}
/**
* Fetch cache using the nested FetchGroup.
*/
public R fetchCache(FetchGroup<T> nestedGroup) {
public final R fetchCache(FetchGroup<T> nestedGroup) {
return fetchNested(nestedGroup, FETCH_CACHE);
}
@@ -177,7 +177,7 @@ public abstract class TQAssocBean<T, R> extends TQProperty<R> {
}
@SafeVarargs
private final Set<String> properties(TQProperty<?>... props) {
private Set<String> properties(TQProperty<?>... props) {
Set<String> set = new LinkedHashSet<>();
for (TQProperty<?> prop : props) {
set.add(prop.propertyName());
@@ -188,7 +188,7 @@ public abstract class TQAssocBean<T, R> extends TQProperty<R> {
/**
* Is equal to by ID property.
*/
public R eq(T other) {
public final R eq(T other) {
expr().eq(_name, other);
return _root;
}
@@ -196,14 +196,14 @@ public abstract class TQAssocBean<T, R> extends TQProperty<R> {
/**
* Is equal to by ID property.
*/
public R equalTo(T other) {
public final R equalTo(T other) {
return eq(other);
}
/**
* Is not equal to by ID property.
*/
public R ne(T other) {
public final R ne(T other) {
expr().ne(_name, other);
return _root;
}
@@ -211,15 +211,14 @@ public abstract class TQAssocBean<T, R> extends TQProperty<R> {
/**
* Is not equal to by ID property.
*/
public R notEqualTo(T other) {
public final R notEqualTo(T other) {
return ne(other);
}
/**
* Apply a filter when fetching these beans.
*/
public R filterMany(ExpressionList<T> filter) {
public final R filterMany(ExpressionList<T> filter) {
@SuppressWarnings("unchecked")
ExpressionList<T> expressionList = (ExpressionList<T>) expr().filterMany(_name);
expressionList.addAll(filter);
@@ -254,7 +253,7 @@ public abstract class TQAssocBean<T, R> extends TQProperty<R> {
* @param expressions The expressions including and, or, not etc with ? and ?1 bind params.
* @param params The bind parameter values
*/
public R filterMany(String expressions, Object... params) {
public final R filterMany(String expressions, Object... params) {
expr().filterMany(_name, expressions, params);
return _root;
}
@@ -268,7 +267,7 @@ public abstract class TQAssocBean<T, R> extends TQProperty<R> {
* This expression only works on OneToMany and ManyToMany properties.
* </p>
*/
public R isEmpty() {
public final R isEmpty() {
expr().isEmpty(_name);
return _root;
}
@@ -282,7 +281,7 @@ public abstract class TQAssocBean<T, R> extends TQProperty<R> {
* This expression only works on OneToMany and ManyToMany properties.
* </p>
*/
public R isNotEmpty() {
public final R isNotEmpty() {
expr().isNotEmpty(_name);
return _root;
}
@@ -38,21 +38,21 @@ public class TQProperty<R> {
/**
* Internal method to return the underlying expression list.
*/
protected ExpressionList<?> expr() {
return ((TQRootBean) _root).peekExprList();
protected final ExpressionList<?> expr() {
return ((TQRootBean<?,?>) _root).peekExprList();
}
/**
* Return the property name.
*/
protected String propertyName() {
protected final String propertyName() {
return _name;
}
/**
* Is null.
*/
public R isNull() {
public final R isNull() {
expr().isNull(_name);
return _root;
}
@@ -60,7 +60,7 @@ public class TQProperty<R> {
/**
* Is not null.
*/
public R isNotNull() {
public final R isNotNull() {
expr().isNotNull(_name);
return _root;
}
@@ -27,7 +27,7 @@ public class TQPropertyBase<R> extends TQProperty<R> {
/**
* Order by ascending on this property.
*/
public R asc() {
public final R asc() {
expr().order().asc(_name);
return _root;
}
@@ -35,7 +35,7 @@ public class TQPropertyBase<R> extends TQProperty<R> {
/**
* Order by descending on this property.
*/
public R desc() {
public final R desc() {
expr().order().desc(_name);
return _root;
}
+3 -3
View File
@@ -15,7 +15,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean</artifactId>
<version>13.8.0-SNAPSHOT</version>
<version>13.8.1-SNAPSHOT</version>
</dependency>
<dependency>
@@ -27,7 +27,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-test</artifactId>
<version>13.8.0-SNAPSHOT</version>
<version>13.8.1-SNAPSHOT</version>
<scope>test</scope>
</dependency>
@@ -53,7 +53,7 @@
<path>
<groupId>io.ebean</groupId>
<artifactId>querybean-generator</artifactId>
<version>13.8.0-SNAPSHOT</version>
<version>13.8.1-SNAPSHOT</version>
</path>
</annotationProcessorPaths>
</configuration>
+2 -2
View File
@@ -35,14 +35,14 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-test</artifactId>
<version>13.8.0-SNAPSHOT</version>
<version>13.8.1-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-core</artifactId>
<version>13.8.0-SNAPSHOT</version>
<version>13.8.1-SNAPSHOT</version>
<scope>test</scope>
</dependency>