Dropped Pageable.NONE in favor of ….unpaged() for consistency with Sort.unsorted(). Extracted the implementation for the value backing it into an Unpaged enum instance. Introduced defaulted isPaged() / isUnpaged() to avoid having to compare instances.
JavaDoc in Sort and a couple of API polishes.
Make use of lambdas and method references though out the codebase. Remove no longer required generic type parameters.
Additionally remove unused imports and replace single element list initialization with dedicated singletonList.
Use Assertion overloads taking Supplier for dynamic assertion error messages.
Introduced @DomainEvents usable on a method of an aggregate root. The method will be invoked when the aggregate is passed to a repository to save and its returned value or values will be exposed via an ApplicationEventListener.
Also, the aggregate can expose a method annotated with @AfterDomainEventPublication which will be invoked once all events have been published.
The introduced method allows creating new Order instances for a different property ensuring all other aspects (ignore case, null handling) are retained.
Introduced dedicated RevisionSort property that allows to define the sort order independent of the revision property to be used.
Introduced methods to find out whether a Sort is descending or ascending to avoid having to refer to the enum.
We now provide equals(…) and hashCode() methods for GenericPropertyMatcher, PropertySpecifier and PropertySpecifiers so that they can be compared and used in sets.
Original pull request: #175.
Introduced dedicated factory methods for ExampleMatcher so that it exposes whether the predicates built from Example instances have to be fulfilled all or if it's sufficient that any of them matches.
Renamed ExampleSpecification to ExampleMatcher and introduced a matching() factory method, dropping the dedicated override mechanism for types for now. Updated documentation accordingly.
Used Lombok for constructor creation, field defaults, toString() as well as equals(…) and hashCode() implementations.
Tweaked imports in unit tests. Renamed methods to express expected behavior.
Original pull request: #153.
Split Example and ExampleSpec to create reusable components. Refactor builder pattern to a fluent API that creates immutable instances. Split user and framework API, Example and ExampleSpec are user API, created ExampleSpecAccessor for modules to access example spec configuration. Create static methods in GenericPropertyMatchers to ease creation of matchers in a readable style. Convert PropertySpecifier to inner class and move PropertySpecifiers to ExampleSpec.
Related tickets: DATAJPA-218, DATAMONGO-1245.
Original pull request: #153.
Added required types for Query by Example which should be used by the individual store implementations.
Generally the Example type captures a sample object and allow various settings concerning the mapping into an actual query. So there’s configuration options for handling null values, string matching, property paths to ignore,
Related tickets: DATAJPA-218, DATAMONGO-1245.
Original pull request: #153.
On a last page the total handed into a PageImpl constructor might not necessarily fit the content as there's the change of an insertion or deletion between the calculated count and the retrieval of the content. We now leniently mitigate those differences if the page created is the last page of the result.
Related tickets: DATAJPA-728, DATACMNS-615.
Primarily intended to be used with Distance instances, we introduce a Range value type. Distance now has factory methods to create Range instances between two distances. To support this, Distance now implements comparable based on the normalized value of it.
Tiny refactoring in TypeDiscoverer to avoid code duplication between the lookup of parameter type information for constructors and methods.
Introduced a map(Converter converter) method on Slice and Page to be able to easily transform the elements and create a new Slice or Page of the transformation result.
On Java 8 this allows code like this:
Page<String> strings = …;
Page<Integer> ints = strings.map(String::length);
PageImpl now makes sure that the total given to the constructor is never less than then number of items given to make sure we do not mask broken count calculation by creating an actually invalid instance.
Related ticket: DATAMONGO-1120.
Fixed @since-tags, added author tags where appropriate, fixed copyright header in SortUnitTests. Removed unnecessary formatting line comments. Renamed nullHandlingHint to nullHandling inside Order. Changed builder method signatures to be consistent with with(…) methods defining the direction.
Fixed copy & paste test in SortUnitTests.
Original pull request: #79.
Null handling hints can now be configured on Order as being either NATIVE (we let the data store decide how to order nulls), NULLS_FIRST or NULLS_LAST.
This is the foundation for custom null-handling in other data store support modules like SD JPA and SD MongoDB.
Original pull request: #79.
Introduced a Slice interface which is effectively a Page without the total page information. This will allow store modules to implement slice-by-slice access without having to calculate a total number of elements.
Extracted content and Pageable related functionality into a common Chunk class which serves as base class for the two concrete implementations SliceImpl and PageImpl. Deprecated hasNextPage() etc. on Page in favor of the generic hasNext() methods.
QueryMethod now exposes an isSliceQuery() to indicate a query method will need sliced execution.
Previously we did only support ordering by a string or property path through Sort. In order to be able to express more type safe ordering expressions we introduce QSort as a subclass of Sort that is able to wrap QueryDSL OrderSpecifiers. To be able to separate the concerns of sorting via QueryDSL expressions better we introduce the AbstractPageRequest base class and QPageRequest as a special implementation that accepts a QSort or OrderSpecifiers for ordering.
Original pull request: #59.
PageRequest now actively prevents page sizes less than one. PageableHandlerMethodArgumentResolver falls back to default page size if it detects a page size less than one. It also rejects invalid default configuration using @PageableDefault.
So far, the PageImpl class returned 0 as total number of pages if set up from a plain List. This returns 1 now (as it should be). We've also adapted the hasNextPage() implementation to correctly calculate whether a next page is available.