You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main/antora/modules/ROOT/pages/property-paths.adoc
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -106,7 +106,7 @@ NOTE: For implementation details, refer to <<property-path-internals>> for more
106
106
=== Property Path Internals
107
107
108
108
The {spring-data-commons-javadoc-base}/org/springframework/data/core/package-summary.html[`org.springframework.data.core`] package is the basis for Spring Data's navigation across domain classes.
109
-
The javadoc:org.springframework.data.core.TypeInformation[] interface provides type introspection capable of resolving the type of a property. javadoc:org.springframework.data.core.PropertyPath[] represents a textual navigation path through a domain class.
109
+
The {spring-data-commons-javadoc-base}/org/springframework/data/core/TypeInformation.java[`TypeInformation`] interface provides type introspection capable of resolving the type of a property. {spring-data-commons-javadoc-base}/org/springframework/data/core/PropertyPath.java[`PropertyPath`] represents a textual navigation path through a domain class.
110
110
111
111
Together they provide:
112
112
@@ -121,7 +121,7 @@ Type-safe property-references eliminate a common source of errors in data access
121
121
This section explains how method references can be used to express refactoring-safe property paths.
122
122
123
123
While a property path is a simple representation of object navigation, String-based property paths are inherently fragile during refactoring as they can be easily missed with an increasing distance between the property definition and its usage.
124
-
Type-safe alternatives derive property paths from method references, enabling the compiler to validate property names and IDEs to support refactoring operations.
124
+
Type-safe alternatives through {spring-data-commons-javadoc-base}/org/springframework/data/core/TypedPropertyPath.java[`TypedPropertyPath`] derive property paths from method references, enabling the compiler to validate property names and IDEs to support refactoring operations.
When using (or building) APIs using type-safe property-references, consider the following recommendations:
195
195
196
196
* **Use method references**: Accept method references (e.g., `Person::getFirstName`) instead of strings to leverage compile-time validation and IDE refactoring support.
197
-
Method references are preferred as they share similary representations with both Java and Kotlin.
197
+
Method references are preferred as they share similar representations with both Java and Kotlin.
198
198
Additionally, method references provide a better performance baseline compared to lambdas due to their simpler representation.
199
199
* **Leverage the `T` type of `TypedPropertyPath`**: Whenever accepting a typed property path, consider using the generic type `T` of `TypedPropertyPath<T, P>`.
200
200
Limiting property paths to a specific domain type that is used within the current operation reduces the potential of using unintended properties from other types. +
0 commit comments