Skip to content

Commit 50b6762

Browse files
committed
Polishing.
See #1625 Original pull request: #1626
1 parent c49fcd1 commit 50b6762

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/query/ColumnName.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ public abstract class ColumnName {
4747
* @since 5.1
4848
*/
4949
public static <T, P> ColumnName from(TypedPropertyPath<T, P> property) {
50-
return from((PropertyPath) TypedPropertyPath.of(property));
50+
// lambdas/method references do not provide equality semantics, so we need to obtain the resolved PropertyPath
51+
// variant
52+
return from((PropertyPath) (TypedPropertyPath.of(property)));
5153
}
5254

5355
/**
@@ -213,8 +215,14 @@ public PropertyPath getPropertyPath() {
213215

214216
@Override
215217
public boolean equals(@Nullable Object obj) {
216-
return super.equals(obj)
217-
&& (obj instanceof PropertyPathColumnName that && this.propertyPath.equals(that.propertyPath));
218+
219+
if (obj instanceof PropertyPathColumnName that) {
220+
if (!this.propertyPath.equals(that.propertyPath)) {
221+
return false;
222+
}
223+
}
224+
225+
return super.equals(obj);
218226
}
219227

220228
@Override

spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/query/Columns.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ public static <T> Columns from(TypedPropertyPath<T, ?>... properties) {
8585
Map<ColumnName, List<Selector>> columns = new LinkedHashMap<>(properties.length, 1);
8686

8787
for (TypedPropertyPath<T, ?> columnName : properties) {
88-
TypedPropertyPath<T, ?> path = TypedPropertyPath.of(columnName);
89-
add(columns, ColumnName.from(path));
88+
add(columns, ColumnName.from(columnName));
9089
}
9190

9291
return new Columns(columns);

src/main/antora/modules/ROOT/nav.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
** xref:cassandra/template.adoc[]
1616
** xref:cassandra/prepared-statements.adoc[]
1717
** xref:object-mapping.adoc[]
18+
** xref:property-paths.adoc[]
1819
** xref:cassandra/converters.adoc[Type-based Converter]
1920
** xref:cassandra/property-converters.adoc[]
2021
** xref:cassandra/events.adoc[]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include::{commons}@data-commons::page$property-paths.adoc[]

0 commit comments

Comments
 (0)