spring-data-commons
spring-data-commons copied to clipboard
Introduce first-class type-safe property path references at the core level
We now support type-safe property paths and property references:
Java variants:
PropertyPath.from("name", Person.class) // existing String-based API
PropertyPath.of(Person::getName) // type-safe property reference expression
PropertyPath.from("address.country", Person.class) // existing nested path API
PropertyPath.of(Person::getAddress).then(Address::getCountry) // type-safe composed path expression
PropertyReference.of(Secret::getSecret)
Kotlin variants:
PropertyReference.of(Secret::secret)
PropertyPath.of(Person::address / Address::city)
allowing type-safe usage through e.g.:
Sort.by(Person::getFirstName, Person::getLastName)
Module adoption:
- [ ] https://github.com/spring-projects/spring-data-jpa/pull/4086
- [ ] MongoDB
- [ ] Relational
- [ ] https://github.com/spring-projects/spring-data-cassandra/pull/1626