Commit Graph

1325 Commits

Author SHA1 Message Date
Christoph Strobl
0c0c1afc8e Add WindowIterator and rename Scroll to Window.
The intend of WindowIterator is to support users who need to iterate multiple windows. It keeps track of the position and loads the next window if needed so that the user does not have to interact with the position at all.

Also remove the Window methods to get the first/last position and enforce the index based variant.

Update the documentation to make use of the newly introduced API.

See: #2151
Original Pull Request: #2787
2023-03-16 13:10:40 +01:00
Mark Paluch
035965a3a2 Introduce Scroll API.
See: #2151
Original Pull Request: #2787
2023-03-16 13:09:39 +01:00
Oliver Drotbohm
116730c168 Polishing.
Imports, Javadoc, ticket references in test cases.

Removed the need for MethodParameterAware… flavors of the ResourceAssemblers by keeping the MethodParameter reference in the original assemblers in the first place. Extracted common Pageable MethodParameter lookup code into PageableMethodParameterUtils.

Related ticket: #1307.
2023-02-28 17:00:37 +01:00
Michael Schout
70f21bda9f Add SlicedResourcesAssembler for web integration.
Added SlicedResourcesAssembler to esaily convert Slice instances into SlicedResource instances and automatically build the required previous/next link based on PageableHandlerMethodArgumentResolver present in the MVC configuration. The assembler can either be injected into a Spring MVC controller or a controller method. The latter will then assume the controller methods URI to be used as pagination link base.

Added necessary SlicedResourcesAssemblerArgumentResolver and MethodParameterAwareSlicedResourcesAssembler classes and wire up HateoasAwareSpringDataWebConfiguration configuration beans to that SlicedResourcesAssembler's can be auto-injected into controllers.

Closes #1307
2023-02-28 10:06:10 +01:00
Mark Paluch
83655663ea Refine QuerydslRepositoryInvokerAdapter nullability assertions.
QuerydslRepositoryInvokerAdapter now rejects null predicates to enforce nullability constraints.

Closes #1501
2023-02-24 11:04:11 +01:00
Mark Paluch
f82a48454e Polishing.
Use consistently domain type instead of introducing a new terminology to repository infrastructure.

Rename Kotlin variant of ParameterUnitTests to KParameterUnitTests to avoid duplicate classes.

See #2770
Original pull request: #2771
2023-02-14 14:29:12 +01:00
Oliver Drotbohm
16e7e7c79b Query method parameters are now aware of aggregate reference type.
To support the binding of Class parameters to queries for declared query methods, we have to be able to differentiate them from Class parameters that are supposed to represent projections. We can do that by relating the declared Class' element type to the aggregate root type as a Class typed to that or any subtype of it will never trigger a projection by definition.

So far the Parameter(s) abstraction was solely created from a query method's Method. We now changed that for QueryMethod to forward the aggregate type detected on the RepositoryMetadata and consider it during the detection of dynamic projection parameters.

As a mitigating measure, we now also support @Param on Class-typed parameters to explicitly mark them for query binding. This is primarily to be able to add this support to the 2.7

The changes are built in a way that modules extending that mechanism will continue to work as is but see deprecation warnings on methods and constructors involved. Adapting extending code to the new APIs will automatically enable the support for bindable Class parameters on query methods.

Fixes #2770.
Original pull request: #2771
2023-02-14 14:28:05 +01:00
ByungjunYou
7cf4cf9baa Fix a typo in javadoc.
Closes #2739
2023-01-23 14:13:37 +01:00
Mark Paluch
b3dcbbe1a7 Polishing.
Reorder statements for higher cohesion.

See #2760
Original pull request: #2762
2023-01-11 11:15:39 +01:00
Christoph Strobl
0bd2714595 Use unique bean name for configuration post processors.
Closes #2760
Original pull request: #2762
2023-01-11 11:15:39 +01:00
Mark Paluch
4c2b8ac4c8 Polishing.
Introduce common exclusion rules for constructors.

See: #2744
Original pull request: #2746
2023-01-11 11:11:14 +01:00
Christoph Strobl
1d7c1ff6e0 Exclude synthetic constructors from AOT inspection.
Java8 bytecode may contain synthetic constructors that refer to anonymous classes which should not be inspected.

Eg. the following construct results in bytecode as listed further down below.

public enum Outer {

    INSTANCE {
        @Override
        public Inner getInnerType() {
            return Inner.STANDALONE;
        }
    },

    public abstract Inner getInnerType();
}

synthetic Outer(java.lang.String arg0, int arg1, Inner$1 arg2)

See: #2744
Original pull request: #2746
2023-01-11 11:08:13 +01:00
Christoph Strobl
a2b3615572 Exclude local and anonymous classes from AOT type inspection.
Also update the type filter that would not mach types directly present in the given package.
Modify type contribution method to allow store specific override.

Closes: #2744
Original pull request: #2746
2023-01-11 11:08:13 +01:00
Oliver Drotbohm
6fd8ae4917 Improve Lazy.toString().
Added dedicated Lazy.toString() rendering the resolved value's ….toString() method but resorts to a constant [Unresolved] if it's not already resolved. An additional ….toString(Supplier<String>) allows to customize the fallback message if needed.

Fixes #2751.
2023-01-05 11:45:00 +01:00
Mark Paluch
14919995ad Extend license header copyright years to 2023.
See #2756
2023-01-02 09:53:28 +01:00
John Blum
bdfb1f8a7f Fix formatting in PropertyReferenceException message.
A message like, "No property 'creat' found for type 'User' Did you mean ''created''" is now properly formatted as:
"No property 'creat' found for type 'User'; Did you mean 'created'".

Closes #2750.
2022-12-12 13:02:23 -08:00
Mark Paluch
f8d6c9f026 Polishing.
Avoid caching. Expand exception handling to all reflective exceptions. Fix since tags.

See: #2721
Original pull request: #2743.
2022-12-12 10:37:56 +01:00
Christoph Strobl
016e8c2779 Register reflection hints for Querydsl Q types.
This commit introduced support for registering GraalVM native reflection type hints for Querydsl Q types that target domain types used in the repository interface declaration.

At this point we only do a simple lookup for Q types based in the very same package that implement EntityPath.
More advanced configuration (eg. base package and type prefix), potentially available via EntityPathResolver are not taken into account as this would require eager bean resolution from the application context, which is likely to trigger additional infrastructure. In this case the user is required to register Q types manually.

Closes: #2721
Original pull request: #2743.
2022-12-12 10:37:56 +01:00
Jens Schauder
d56bbbdefb Make dependency tests based on ArchUnit.
The DependencyTests are reimplemented using ArchUnit and enabled.

See #2708
Original pull request #2706
2022-11-02 11:08:37 +01:00
Mark Paluch
6190baa3db Move ReactiveWrappers into o.s.d.util package.
ReactiveWrappers is not tied to repositories so it does not need to reside in the repository.util package. This utility is now located in the data.util package for a better module design and to prevent package cycles.

See #2708
2022-11-02 10:52:11 +01:00
Mark Paluch
5b784d006f Polishing.
Remove duplicate license headers. Avoid fully-qualified type usage where possible.

See #2708
2022-11-02 10:51:42 +01:00
Christoph Strobl
8d424855da Resolve package cycle between repository.config and repository.aot.
Closes #2708
2022-11-02 10:51:26 +01:00
Mark Paluch
92a6ec800c Polishing.
Use for-loop instead of stream to reduce overhead.

See #2722
2022-10-27 09:36:31 +02:00
Mark Paluch
0e57ea8872 Polishing.
Add reactive Query by Example and reactive/imperative Querydsl type hints.

See #2717
Original pull request: #2720
2022-10-19 11:44:58 +02:00
Christoph Strobl
c2293efb02 Add missing reflection hints.
Allow Kotlin to resolve everything it needs.

Closes #2717
Original pull request: #2720
2022-10-19 11:44:58 +02:00
Oliver Drotbohm
39e79a144e Consistently apply method ordering in DefaultProjectionInformation.
Fixes #2718.
2022-10-17 14:31:51 +02:00
Christoph Strobl
9e157dcf8f Polishing.
Update exception messages, align method names, extract methods
Original Pull Request: #2488
2022-10-12 14:40:19 +02:00
Mark Paluch
70cda7949d Consider component names for custom implementation and fragment bean registration.
We now consider the the actual repository & fragment bean name when checking for existing bean definitions of default custom implementation beans. Previously, we used the repository interface name without considering the repository bean name.

Closes #2487.
Original Pull Request: #2488
2022-10-12 14:39:30 +02:00
Mark Paluch
103d41f7f4 Resolve package cycle between repository and aot packages.
Closes #2707
2022-10-11 11:44:45 +02:00
Mark Paluch
0fe04e37f8 Polishing.
Refine control flow.

See #2704
Original pull request: #2705.
2022-10-10 13:47:37 +02:00
Christoph Strobl
529f88cf4c Use explicit type declarations for generated code.
See #2704
Original pull request: #2705.
2022-10-10 13:47:32 +02:00
Christoph Strobl
1fde452ab9 Fix AOT code generation for managed types.
Closes #2704
Original pull request: #2705.
2022-10-10 13:47:12 +02:00
Mark Paluch
b55f098b43 Remove references to ClassTypeInformation from TypeInformation.
Closes #2703
2022-10-06 16:20:22 +02:00
Jens Schauder
db34b52b89 Remove non Javadoc comments.
Closes #2699
2022-10-05 15:39:44 +02:00
Christoph Strobl
c5e95c251b Follow API changes in Spring Framework.
Closes: #2698
See: spring-projects/spring-data-build#1809
2022-10-05 11:06:59 +02:00
Christoph Strobl
9e9ddbf334 Use BindingReflectionHintsRegistrar to add reflection hints on types.
Closes: #2683
Original pull request: #2684.
2022-10-05 09:02:31 +02:00
Mark Paluch
9c993e22f5 Polishing.
Reformat code and reorder methods according to visibility. Reduce type and method visibility where applicable.

See #2680
Original pull request: #2682.
2022-10-04 15:46:14 +02:00
Christoph Strobl
e7cc9a6104 Generate custom bean initialization code for types exposed via ManagedTypes during AOT.
We now replace ManagedTypes bean definitions with generated code that contain the discovered types to avoid class path scaning.

Closes: #2680
Original pull request: #2682.
2022-10-04 15:46:14 +02:00
Mark Paluch
6a0a404ef2 Fall back to canonical constructor in constructor resolution when using Java Records.
We now fall back to the canonical constructor of records when we cannot disambiguate which constructor to use.

Also, reflect the Kotlin persistence creator mechanism.

Closes #2625
Original pull request: #2694.
2022-10-04 15:05:15 +02:00
Jens Schauder
e003edccc3 Improve documentation of SpelQueryContext.
Close #2693
2022-09-30 13:03:10 +02:00
Mark Paluch
cdcd21a064 Allow functional mapping of Range and Boundary.
We now support functional mapping of Range values by accepting a mapping function.

Closes #2692
2022-09-26 14:12:24 +02:00
Christoph Strobl
f157eff53c Remove usage of RuntimeHintsUtils & SynthesizedAnnotation.
Closes: #2685
2022-09-06 17:48:36 +02:00
Mark Paluch
9e94e110e4 Fix argument conversion in QuerydslPredicateBuilder.
We now consider the correct argument type instead of checking assignability of the actual property type against the input value.

Closes: #2649
Original Pull Request: #2650
2022-08-30 15:50:34 +02:00
Mark Paluch
a73b0d9936 Improve Pageable Javadoc.
Closes #2679
2022-08-23 10:34:32 +02:00
Mark Paluch
02ec7ed19d Polishing.
Update Kotlin, Reactive and List repository variant documentation.

See #2651
Original pull request: #2673.
2022-08-05 10:49:53 +02:00
Jens Schauder
7ff171fa1d Clarify behaviour of when save or delete operations result in a NOOP.
Behaviour of implementing modules need to adapt to the new clarification.

Closes #2651
Original pull request #2673
2022-08-05 10:49:46 +02:00
MINSOO, NAM
e9852fcdc7 Change initialCapacity in AnnotationAuditingMetadata to match the number of data being added.
As support for Joda Time has been removed from the PR below, the amount of data added has been reduced. So I change the initialCapacity of List from 5 to 3.

Closes #2668
2022-08-05 09:12:12 +02:00
Mark Paluch
42dadd89b4 Use CompletableFuture instead of deprecated ListenableFuture.
Closes #2669
2022-07-29 14:33:11 +02:00
Mark Paluch
7e1712a5de Refine @PageableDefault and @SortDefault annotations.
We now use MergedAnnotations to evaluate annotation attributes and to use aliasing across attributes. Also, SortDefault is not repeatable.

Closes #2657
2022-07-27 09:46:39 +02:00
Christoph Strobl
74e52612bf Use ManagedType BeanDefinition for AOT processing when possible.
We now try to read the types directly from the bean definition arguments first, before attempting to resolve the actual bean instance.
If resolving the bean fails, we currently only log an info message. This arrangement needs to be revisited.

See: #2593
2022-07-13 12:18:18 +02:00