Commit Graph

1435 Commits

Author SHA1 Message Date
mawen12
939c6143c1 Remove redundant code in DefaultEntityCallbacks#callback.
Original pull request: #3053
Closes #3055
2024-03-01 11:45:43 +01:00
Mark Paluch
f7a1066143 Consider nested generics in TypeDiscoverer equality comparison.
We now compare nested generics wrapped into TypeInformation to consider type equality for deeply parametrized types.

Previously, we resolved type parameters to Class so Foo<List<String>> was considered equal to Foo<List<Map>> as the type parameter of the first nesting level was erased.

Closes #3051
2024-02-27 11:18:29 +01:00
Mark Paluch
047b6be83f Polishing.
Tiny naming tweaks.

See #3041
Original pull request: #3048
2024-02-21 14:19:51 +01:00
Christoph Strobl
9d73853244 Default generic type arguments when resolving KType from a Class.
We now fill up missing KTypeProjection arguments with star because the Kotlin Reflection.typeOf resolution fails if arguments are not provided.

Closes #3041
Original pull request: #3048
2024-02-21 14:19:51 +01:00
Mark Paluch
75728ac0be Fix Javadoc build.
Remove package-info for package without sources.

See #3045
2024-02-19 16:12:38 +01:00
Mark Paluch
9563f637fd Document converter types supported by CustomConversions.
Closes #3040
2024-02-14 09:24:50 +01:00
Mark Paluch
67163d02e3 Evolve ValueExpressionParser.
Introduce literal, expression and placeholder variants. Add parser for composite expressions.

Closes #2369
Original pull request: #3036
2024-02-12 15:35:19 +01:00
Christoph Strobl
9f13e5450d Add support for Value Expressions.
We now support Value Expressions such as `#{1+1}-${spring.application.name:fallback-value}` that are composed of SpEL expressions, literals and Property Placeholders.

See #2369
Original pull request: #3036
2024-02-12 15:35:18 +01:00
Mark Paluch
f6eacd208a Polishing.
Add additional tests, add Javadoc to explain isEnclosingClassParameter() behavior.

See #3038
Original pull request: #3039
2024-02-08 10:25:21 +01:00
Christoph Strobl
45b810a83c Use enclosing class constructor parameter only for non-static inner classes.
Closes #3038
Original pull request: #3039
2024-02-08 10:25:21 +01:00
Christoph Strobl
18386c8b40 Guard AOT registration of PageModule.
This commit makes sure to only register runtime hints for PageModule if Jackson is present.
Use newly introduced ClassPathExclusions instead of manually creating the ClassLoader.

Closes #3033
Original pull request: #3034
2024-01-24 16:18:17 +01:00
Mark Paluch
09ea4426c5 Polishing.
Move hints into AOT package to align with other hints. Reduce visibility.

See: #3025
Original pull request: #3026
2024-01-22 09:22:02 +01:00
Christoph Strobl
3f2f013522 Add missing runtime hit for Unpaged required by PageModule.
The PageModule is loading the Unpaged type via its name which requires additional reflection configuration for native images.

Closes: #3025
Original pull request: #3026
2024-01-22 09:22:02 +01:00
Christoph Strobl
391ef3ea83 Polishing.
Remove unused imports.

See: #3025
Original pull request: #3026
2024-01-22 09:22:02 +01:00
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