Commit Graph

1421 Commits

Author SHA1 Message Date
Oliver Drotbohm
fe885b3b9b Fixing Javadoc.
Related: GH-3024.
2024-01-12 21:49:50 +01:00
Oliver Drotbohm
2c0ef666fe Polishing.
Related GH-3023.
2024-01-12 21:49:50 +01:00
Oliver Drotbohm
12efa9ae78 Fix potential IllegalStateException in Limit.
Fixes GH-3023.
2024-01-12 21:49:50 +01:00
Oliver Drotbohm
5dd7b322b6 Support for simplified rendering of Page instances via PagedModel.
This commits all necessary infrastructure to produce simplified JSON representation rendering for Page instances to make sure the representations stay stable and do not expose unnecessary implementation details. The support consists of the following elements:

- PagedModel, a stripped down variant of the Spring HATEOAS counterpart to produce an equivalent JSON representation but without the hypermedia elements. This allows a gradual migration to Spring HATEOAS if needed. Page instances can be wrapped into PagedModel once and returned from controller methods to create the new, simplified JSON representation.

- @EnableSpringDataWeb support now contains a pageSerializationMode attribute set to an enum with two possible values: DIRECT, which is the default for backwards compatibility reasons. It serializes Page instances directly but issues a warning that either the newly introduced support here or the Spring HATEOAS support should be used to avoid accidentally breaking representations. The other value, VIA_DTO causes all PageImpl instances to be rendered being wrapped in a PagedModel automatically by registering a Jackson StdConverter applying the wrapping transparently.

Internally, the configuration of @EnableSpringDataWebSupport is translated into a bean definition of a newly introduced type SpringDataWebSettings and wired into the web configuration for consideration within a Jackson module, customizing the serialization for PageImpl.

Fixes GH-3024.
2024-01-12 21:49:50 +01:00
Oliver Drotbohm
4ebe9361ed Issue a warning log when serializing PageImpl to JSON directly.
We now issue a one-time warning log if Jackson gets handed a PageImpl to serialize as the Jackson structure might need to change for arbitrary other reasons.

Fixes GH-2987.
2024-01-12 21:49:49 +01:00
Oliver Drotbohm
3f14df6562 Fix broken serialization of Unpaged instances.
We now reinstantiate the serialization of Unpaged instances as plain INSTANCE strings as they were rendered before Unpaged was changed from an enum into a class.

Note, that we still strongly advise, not to serialize Page instances directly as it's a domain type, its Jackson-level surface is subject to change if we need to change the type's API for unrelated reasons.

Fixes: GH-2987.
2024-01-12 21:49:49 +01:00
Mark Paluch
34b24a5c22 Consider enclosing class for dynamic projection parameter detection.
We now consider the enclosing class to determine correct generic typing.

Closes #3020
2024-01-11 11:04:46 +01:00
Mark Paluch
20d150f95e Polishing.
Add missing override annotations. Refactor TypeFilterFunction into function to avoid additional property references.
Move off deprecated code.

Closes #3016
2024-01-09 14:41:41 +01:00
Mark Paluch
98d265f91c Extend license header copyright years to 2024.
See #3015
2024-01-02 14:41:38 +01:00
Mark Paluch
24151566d4 Resolve generics for Kotlin Value Boxing inspection.
To introspect value boxing rules, we now resolve Kotlin type parameters.

Closes #2986
2023-12-14 14:56:27 +01:00
Mark Paluch
ff1abf0970 Polishing.
Use IdentityHashMap for parameter lookup.

See #3000
2023-12-14 14:35:32 +01:00
leeyohan93
e0cddb13f7 Enhance Kotlin Class Conversion by Minimizing Equals Comparisons.
Closes #3000
2023-12-14 14:35:31 +01:00
Mark Paluch
f3e92b0eba Polishing.
Fix Javadoc reference. Reorder tags.

See #2531
2023-12-13 08:46:19 +01:00
Oliver Drotbohm
afc2ea80a3 Adapt SortHandlerMethodArgumentResolver after changes to sort parameter.
Since the introduction of 6e22ffd, the sort parameter has been rendered as composite parameter which will cause the comma used to delimit property from direction potentially be encoded by clients following the URI template RFC. Thus, we need to defensively decode the source parameter value before parsing.

Related ticket: GH-2531.
2023-12-12 22:09:06 +01:00
Mark Paluch
d7732182ee Remove deprecated methods.
See #2996
Closes #2995
2023-12-08 11:06:10 +01:00
Mark Paluch
bd05ed1dda Introduce ParametersSource to Parameters.
We now provide a ParametersSource object to create MethodParameter objects associated with the enclosing class so parameters can resolve generics properly.

Closes #2996
2023-12-08 11:04:54 +01:00
Oliver Drotbohm
0cf2538f97 Avoid records as cache keys for performance reasons.
Fixes GH-2997.
2023-12-05 14:17:11 +01:00
Julien Béti
6e22ffd103 Properly render sort variable variable as composite.
HateoasSortHandlerMethodArgumentResolver now renders the sort template variable as composite to properly indicate that it can be submitted multiple times.

Fixes GH-2531.
Original pull request GH-2945.
2023-12-01 21:26:03 +01:00
Mark Paluch
1548ab6551 Omit asymmetric Kotlin properties.
We now skip adding asymmetric Kotlin properties if the getter returns a different type than the setter (e.g. due to value boxing).

Closes #2993
2023-11-29 15:51:58 +01:00
Mark Paluch
8a679156e0 Include inherited non-Kotlin properties in KotlinBeanInfoFactory.
We now include properties from non-Kotlin supertypes if the supertype is not a Kotlin type and not Object.

Closes #2994
2023-11-29 15:51:53 +01:00
Mark Paluch
295d14e34d Backoff KotlinBeanInfoFactory for enum types.
We now no longer contribute properties for enum types.

Closes #2990
2023-11-29 10:51:16 +01:00
Mark Paluch
197e4cc112 Polishing.
Use for-loop instead of Java Stream API for concatenation of paths to reduce GC and CPU pressure.

See #2992
2023-11-29 09:21:20 +01:00
Mark Paluch
ee452d543a Allow reuse of TypeInformation when obtaining a PersistentPropertyPath.
Closes #2992
2023-11-29 09:17:13 +01:00
Mark Paluch
e0b2f1ef4d Polishing.
Fix naming.

Original Pull Request: #2940
2023-11-21 08:44:42 +01:00
Mark Paluch
e04f0b0deb Fallback to StringUtils.uncapitalize(…) when looking up property paths.
Naming restrictions for property paths used in query method names requite capitalization of the first letter regardless whether the property name uses a second-letter uppercase form (zIndex -> ZIndex, qCode -> QCode). In such cases, Introspector.decapitalize(…) shortcuts to non-decapitalization as it checks the second letter casing.

This leads to the case that the property name cannot be resolved, assuming proper property naming (getzIndex(), zIndex()).

Falling back to StringUtils.uncapitalize() allows catching such properties.

Closes: #1851
Original Pull Request: #2940
2023-11-21 08:43:23 +01:00
Jens Schauder
7fab81b406 Fix broken logging message.
Closes #2977
2023-11-16 16:06:11 +01:00
Mark Paluch
97be53bd85 Remove superfluous @NonNull annotations.
Closes #2976
2023-11-13 14:51:12 +01:00
Jens Schauder
3eda7e9e66 Revert "AbstractPersistentProperty now considers the owner for equals."
This reverts commit 633d125f1d.

The change caused build failures for Spring Data JDBC.

See #2972
Original pull request #2973
See spring-projects/spring-data-relational#1657
2023-11-12 11:02:46 +01:00
Mark Paluch
3c872ae7cb Polishing.
Extract singular/plural form into String.format(…) for easier readability.

See #2967
2023-11-09 14:46:50 +01:00
Luis Carilla Ternero
c52520a783 Refine repository scanning finished log message.
Log the plural form accordingly.

Closes #2967
2023-11-09 14:46:39 +01:00
Mark Paluch
65c537cdaa Improve equals check by caching resolved generics.
Closes: #2974
2023-11-09 08:29:57 +01:00
Jens Schauder
633d125f1d AbstractPersistentProperty now considers the owner for equals.
This makes a difference when a property is declared in a superclass of two entities.
In such a case the property is the same, but the owner is different.

Closes #2972
Original pull request #2973
See https://github.com/spring-projects/spring-data-relational/issues/1657
2023-11-08 10:43:15 +01:00
Oliver Drotbohm
38b3099ec5 Simplify DefaultMethodInvokingMethodInterceptor.
As our baseline is now Java 17, we can remove all indirections to produce a Lookup previously needed to support Java 8 and 9.

Fixes #2971.
2023-11-08 08:42:38 +01:00
Mark Paluch
d83dd7e138 Un-mangle Kotlin method names in PartTree.
Due to shortcomings with value classes mangling and the impossible usage of JvmName on Kotlin interfaces, we're inspecting now the method name if it contains a dash (-). If so, then we truncate the method name to be able to parse it.

Closes #2965
2023-10-25 14:48:16 +02:00
Mark Paluch
f060bcfe34 Back off from Kotlin BeanInfo creation for interfaces.
KotlinBeanInfoFactory no longer creates a BeanInfo for interfaces to follow general BeanInfo semantics.

Closes #2964
2023-10-25 11:45:47 +02:00
Mark Paluch
d6507fe45f Polishing.
Tweak Javadoc. Refine tests.

See #2491
2023-10-17 11:50:04 +02:00
Jens Schauder
2561c8e0aa Clarify behavior of PropertyPath.
Update tests and documentation.

Closes #2491
2023-10-17 11:49:44 +02:00
mawen12
3ab8c66e0f Add parameter to exception message format.
Closes: #2956
Original pull request: #2958
2023-10-17 11:25:22 +02:00
Mark Paluch
cbcb848fab Introduce Lock utility.
The Lock utility is an adapter for Java's Lock and ReadWrite Lock types providing an easier to consume programming model (callback-style and try-with-resources).

Closes: #2944
2023-10-05 09:33:45 +02:00
Oliver Drotbohm
8328517cc9 Fix detection of @DomainEvents and @AfterDomainEventPublication on native.
We now unconditionally process the aggregate root types declared on repositories for @Reflective annotations, which @DE and @ADEP got meta-annotated with.

Fixes #2939.
2023-09-21 16:12:19 +02:00
Oliver Drotbohm
5f64564db5 Properly emit domain events from calls to saveAll(…).
We now treat CrudRepository.saveAll(…) properly by unwrapping the given *Iterable*. This previously already worked for collections handed into the method but not for types only implementing Iterable directly (like Page or Window).

Fixes #3153.
Related tickets #2931, #2927.
2023-09-20 14:21:42 +02:00
Mark Paluch
b1a0bb4ff6 Polishing.
Refine Javadoc. Add unit tests.

See #2929
Original pull request: #2930
2023-09-14 10:35:51 +02:00
Greg L. Turnquist
107f268eb5 Make Lazy.orElseGet(Supplier) public.
Closes #2929
Original pull request: #2930
2023-09-14 10:35:41 +02:00
Mark Paluch
d5cd46c1d5 Polishing.
Add reactive type translation to Coroutine methods to return the expected type for AOP processing.

See #2926
2023-09-12 16:29:48 +02:00
Sébastien Deleuze
110756a40a Adapt for Spring Framework Coroutines AOP support.
This commit adapts Spring Data RepositoryMethodInvoker
and related tests in order to remove most of the
Coroutines specific code and rely on Spring Framework
Coroutines AOP support.

Closes #2926
2023-09-12 14:44:51 +02:00
Christoph Strobl
050d8ff508 Update ManagedTypesRegistrationAotContribution to match signature changes.
Closes: #2925
2023-09-12 08:09:13 +02:00
Mark Paluch
8c342a56e8 Polishing.
Fix Javadoc references.

See #2915
Original pull request: #2916
2023-08-31 08:16:49 +02:00
Mark Paluch
df543cd50e Introduce PersistentProperty.isReadable.
isReadable reports whether a property can be read through PersistentPropertyAccessor, by either using property access through setters, a wither, Kotlin Copy method or by accessing the field directly.

Closes #2915
Original pull request: #2916
2023-08-31 08:16:41 +02:00
Mark Paluch
ea9bf5bf86 Replace Stream usage with iteration to avoid non-null requirements.
SpelEvaluator now iterates over the parameter map instead of using the Java 8 Stream API. Previously, expressions resulting in a null value failed in the collector as Java 8 streams require non-null values for map values.

Closes #2904
2023-08-16 15:11:22 +02:00
shin-mallang
b0ffb1a046 Document event publication from repository delete methods in AbstractAggregateRoot.
Added additional comment regarding registerEvent and andEvent in AbstractAggregateRoot.

Closes: #2903
2023-08-16 10:40:07 +02:00