From 8632aef26839ddf66e77207df21ce5bf3c07e562 Mon Sep 17 00:00:00 2001 From: Rob Bygrave Date: Thu, 18 Aug 2022 16:49:39 +1200 Subject: [PATCH 1/2] Add missing final modifier on methods of query bean types --- .../java/io/ebean/typequery/PBaseDate.java | 4 +- .../java/io/ebean/typequery/PBaseNumber.java | 14 +++--- .../java/io/ebean/typequery/PBaseString.java | 22 +++++----- .../java/io/ebean/typequery/PByteArray.java | 3 +- .../java/io/ebean/typequery/PSqlDate.java | 1 - .../java/io/ebean/typequery/TQAssocBean.java | 43 +++++++++---------- .../java/io/ebean/typequery/TQProperty.java | 10 ++--- .../io/ebean/typequery/TQPropertyBase.java | 4 +- 8 files changed, 50 insertions(+), 51 deletions(-) diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PBaseDate.java b/ebean-querybean/src/main/java/io/ebean/typequery/PBaseDate.java index fa4631247..740e4f2d2 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PBaseDate.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PBaseDate.java @@ -32,7 +32,7 @@ public abstract class PBaseDate 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 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; } diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PBaseNumber.java b/ebean-querybean/src/main/java/io/ebean/typequery/PBaseNumber.java index 2c54bb6db..3f1de62d9 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PBaseNumber.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PBaseNumber.java @@ -34,7 +34,7 @@ public abstract class PBaseNumber 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 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 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 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 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 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 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; } diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PBaseString.java b/ebean-querybean/src/main/java/io/ebean/typequery/PBaseString.java index b985842e4..a0f3643d5 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PBaseString.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PBaseString.java @@ -54,7 +54,7 @@ public abstract class PBaseString extends PBaseCompareable { * @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 extends PBaseCompareable { * @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 extends PBaseCompareable { * @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 extends PBaseCompareable { * @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 extends PBaseCompareable { * @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 extends PBaseCompareable { * @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 extends PBaseCompareable { * @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 extends PBaseCompareable { * @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 extends PBaseCompareable { * @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 extends PBaseCompareable { * @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 extends PBaseCompareable { * * @param value the match expression */ - public R match(String value) { + public final R match(String value) { expr().match(_name, value); return _root; } diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PByteArray.java b/ebean-querybean/src/main/java/io/ebean/typequery/PByteArray.java index 222215887..d2bc50353 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PByteArray.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PByteArray.java @@ -5,7 +5,8 @@ package io.ebean.typequery; * * @param the root query bean type */ -public class PByteArray extends PBaseValueEqual { +public final class PByteArray extends PBaseValueEqual { + /** * Construct with a property name and root instance. * diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/PSqlDate.java b/ebean-querybean/src/main/java/io/ebean/typequery/PSqlDate.java index b239dbc34..a935c9212 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/PSqlDate.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/PSqlDate.java @@ -7,7 +7,6 @@ import java.sql.Date; * * @param the root query bean type */ - public final class PSqlDate extends PBaseDate { /** diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/TQAssocBean.java b/ebean-querybean/src/main/java/io/ebean/typequery/TQAssocBean.java index d5843a612..194dcd4f4 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/TQAssocBean.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/TQAssocBean.java @@ -44,7 +44,7 @@ public abstract class TQAssocBean extends TQProperty { /** * 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 extends TQProperty { /** * 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 extends TQProperty { * 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 extends TQProperty { /** * 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 extends TQProperty { /** * 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 extends TQProperty { /** * 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 extends TQProperty { * 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 extends TQProperty { * Deprecated in favor of fetch(). */ @Deprecated - public R fetchAll() { + public final R fetchAll() { return fetch(); } @@ -140,7 +140,7 @@ public abstract class TQAssocBean extends TQProperty { } @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 extends TQProperty { /** * Fetch using the nested FetchGroup. */ - public R fetch(FetchGroup nestedGroup) { + public final R fetch(FetchGroup nestedGroup) { return fetchNested(nestedGroup, FETCH_DEFAULT); } /** * Fetch query using the nested FetchGroup. */ - public R fetchQuery(FetchGroup nestedGroup) { + public final R fetchQuery(FetchGroup nestedGroup) { return fetchNested(nestedGroup, FETCH_QUERY); } /** * Fetch cache using the nested FetchGroup. */ - public R fetchCache(FetchGroup nestedGroup) { + public final R fetchCache(FetchGroup nestedGroup) { return fetchNested(nestedGroup, FETCH_CACHE); } @@ -177,7 +177,7 @@ public abstract class TQAssocBean extends TQProperty { } @SafeVarargs - private final Set properties(TQProperty... props) { + private Set properties(TQProperty... props) { Set set = new LinkedHashSet<>(); for (TQProperty prop : props) { set.add(prop.propertyName()); @@ -188,7 +188,7 @@ public abstract class TQAssocBean extends TQProperty { /** * 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 extends TQProperty { /** * 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 extends TQProperty { /** * 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 filter) { - + public final R filterMany(ExpressionList filter) { @SuppressWarnings("unchecked") ExpressionList expressionList = (ExpressionList) expr().filterMany(_name); expressionList.addAll(filter); @@ -254,7 +253,7 @@ public abstract class TQAssocBean extends TQProperty { * @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 extends TQProperty { * This expression only works on OneToMany and ManyToMany properties. *

*/ - public R isEmpty() { + public final R isEmpty() { expr().isEmpty(_name); return _root; } @@ -282,7 +281,7 @@ public abstract class TQAssocBean extends TQProperty { * This expression only works on OneToMany and ManyToMany properties. *

*/ - public R isNotEmpty() { + public final R isNotEmpty() { expr().isNotEmpty(_name); return _root; } diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/TQProperty.java b/ebean-querybean/src/main/java/io/ebean/typequery/TQProperty.java index fac9efa56..364452832 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/TQProperty.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/TQProperty.java @@ -38,21 +38,21 @@ public class TQProperty { /** * 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 { /** * Is not null. */ - public R isNotNull() { + public final R isNotNull() { expr().isNotNull(_name); return _root; } diff --git a/ebean-querybean/src/main/java/io/ebean/typequery/TQPropertyBase.java b/ebean-querybean/src/main/java/io/ebean/typequery/TQPropertyBase.java index a6b8030a0..83a23e6ab 100644 --- a/ebean-querybean/src/main/java/io/ebean/typequery/TQPropertyBase.java +++ b/ebean-querybean/src/main/java/io/ebean/typequery/TQPropertyBase.java @@ -27,7 +27,7 @@ public class TQPropertyBase extends TQProperty { /** * 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 extends TQProperty { /** * Order by descending on this property. */ - public R desc() { + public final R desc() { expr().order().desc(_name); return _root; } From 2563d52ecfa47c8172939a7a28badd6eca1e8207 Mon Sep 17 00:00:00 2001 From: Rob Bygrave Date: Thu, 18 Aug 2022 16:52:10 +1200 Subject: [PATCH 2/2] Fix versions after release --- ebean-kotlin/pom.xml | 6 +++--- tests/test-java16/pom.xml | 6 +++--- tests/test-kotlin/pom.xml | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ebean-kotlin/pom.xml b/ebean-kotlin/pom.xml index 5e7f254f9..1804821cc 100644 --- a/ebean-kotlin/pom.xml +++ b/ebean-kotlin/pom.xml @@ -6,7 +6,7 @@ ebean-parent io.ebean - 13.8.0-SNAPSHOT + 13.8.1-SNAPSHOT ebean-kotlin @@ -28,7 +28,7 @@ io.ebean ebean-core - 13.8.0-SNAPSHOT + 13.8.1-SNAPSHOT provided @@ -50,7 +50,7 @@ io.ebean ebean-test - 13.8.0-SNAPSHOT + 13.8.1-SNAPSHOT test diff --git a/tests/test-java16/pom.xml b/tests/test-java16/pom.xml index a07b97694..6d67f544b 100644 --- a/tests/test-java16/pom.xml +++ b/tests/test-java16/pom.xml @@ -15,7 +15,7 @@ io.ebean ebean - 13.8.0-SNAPSHOT + 13.8.1-SNAPSHOT @@ -27,7 +27,7 @@ io.ebean ebean-test - 13.8.0-SNAPSHOT + 13.8.1-SNAPSHOT test @@ -53,7 +53,7 @@ io.ebean querybean-generator - 13.8.0-SNAPSHOT + 13.8.1-SNAPSHOT diff --git a/tests/test-kotlin/pom.xml b/tests/test-kotlin/pom.xml index 573f384d2..5ff6af755 100644 --- a/tests/test-kotlin/pom.xml +++ b/tests/test-kotlin/pom.xml @@ -35,14 +35,14 @@ io.ebean ebean-test - 13.8.0-SNAPSHOT + 13.8.1-SNAPSHOT test io.ebean ebean-core - 13.8.0-SNAPSHOT + 13.8.1-SNAPSHOT test