Commit Graph

1247 Commits

Author SHA1 Message Date
John Blum
87c5e866ca Improves the CustomConversions API.
* Annotates the API with Spring's @NonNull and @Nullable annotations.
* Re-instates the hasValueConverter(:PersistentProperty) method.
* Removes explamation mark in Exception messages.
* Uses Java 17 language features to simplify code.
* Edits Javadoc.

Closes #2617.
2022-05-02 13:49:24 -07:00
John Blum
5ce9669c7a Additional refinements.
Resolves #2577
Closes #2592
2022-04-29 14:42:39 -07:00
Mark Paluch
cad739c337 Polishing.
Rename generics from C extends PersistentProperty to P extends PersistentProperty.
Refine conversion setup. Make PropertyValueConversions.getValueConverter(…) to return non-null. Return PropertyValueConversions from CustomConversions.

Resolves #2577
Closes #2592
2022-04-29 14:42:28 -07:00
Mark Paluch
cb5201f9d2 Introduce PropertyValueConversionService and specific null-conversion methods.
PropertyValueConverter read and write methods are never called with null values. Instead, PropertyValueConverter now defines readNull and writeNull to encapsulate null conversion. PropertyValueConversionService is a facade that encapsulates these details to simplify converter usage.

Resolves #2577
Closes #2592
2022-04-29 14:40:43 -07:00
John Blum
d384e40e31 Fix mispelling of ClassUtils.getNumberOfOccurrences(..).
* Re-implement getNumberOfOccurrences(..) in terms of a Stream.
* Deprecate the mispelled getNumberOfOccurences(..) method and delegate to the new getNumberOfOccurrences(..) method.
* Edit Javadoc.

Closes #2600.
2022-04-12 11:15:32 -07:00
John Blum
656ef7e874 Fix grammatical errors in Exception messages.
Closes #2599.
2022-04-12 11:12:31 -07:00
Oliver Drotbohm
1792cd8f45 Fix PersistentEntity lookup in AbstractMappingContext.hasPersistentEntity(…)
Looking up a PersistentEntity via ….getPersistentEntity(…) applies some massaging of the given type as it could be a proxy type created for a user type. That wrangling was not applied in ….hasPersistentEntity(…) which resulted in a call to that method with a proxy type yielding false although it shouldn't if we already have a PersistentEntity available for the corresponding user type.

We now explicitly lookup the entity by original type and, if it's not the user type itself, try to look up the entity for the latter.

Fixes #2589.
2022-04-08 11:39:14 +02:00
Mark Paluch
e25fb0b16a Remove package cycle between mapping and convert.
Remove accessor methods to obtain annotated converters on PersistentProperty.

Closes #2576
2022-04-05 10:34:35 +02:00
Mark Paluch
0792b74549 Polishing.
Improve null-safety. Refine exception signature to avoid exception catching.

See #2590
Original pull request: #2591.
2022-04-05 09:16:28 +02:00
Christoph Strobl
b9eb4d1416 Eagerly initialize SimplePropertyValueConversions.
Closes #2590
Original pull request: #2591.
2022-04-05 09:16:28 +02:00
Oliver Drotbohm
3e9451c939 Polishing for full type information on RepositoryMetadata.
Avoid leaking internals from TypeInformation by exposing a ….toTypeDescriptor() method in TypeInformation directly. This causes the ResolvableType handling to become an implementation detail within ClassTypeInformation and avoid client code to manually deal with both ResolvableType and TypeDescriptor creation.

Changed MethodLookups back to use the resolved domain types as the advanced generics resolutions seems not to be needed here and we can avoid

Fixes #2518.
2022-04-04 16:47:54 +02:00
Alex Nistico
58ed9ce211 Use full type information for identifier and domain types exposed byRepositoryMetadata.
See #2518.
2022-04-01 17:45:15 +02:00
Mark Paluch
21e4fd5ffb Allow using Range with Comparator.
Remove Comparable requirement for general Range usage. Comparable is only required for the contains(…) check. Alternatively, accept a Comparator.

Closes #2571
2022-03-28 15:40:29 +02:00
Mark Paluch
0e5e869cbf Reintroduce explicit local variable types.
We now reinstate local variable types instead of var as general var usage removes contextual detail that cannot be omitted generally.

See #2465
2022-03-28 08:55:29 +02:00
Mark Paluch
c85c4ef2ed Polishing.
Tweak Javadoc comments.

See #2585
2022-03-25 13:37:36 +01:00
Mark Paluch
ef5defe405 Retain case-sensitivity and null-handling when changing Sort direction.
We now retain case-sensitivity and null-handling configuration when changing the entire Sort direction.

Closes #2585
2022-03-25 13:35:49 +01:00
Mark Paluch
f5ee277a6e Gracefully skip non-assignable lambda callbacks on Java 18.
We now consider IllegalArgumentException as marker for incompatible lambda payload that was introduced with Java 18's reflection rewrite that uses method handles internally.

Closes #2583
2022-03-23 10:46:09 +01:00
Mark Paluch
89a6c73c3a Polishing.
Fix Javadoc.

See #2566
2022-03-18 15:15:30 +01:00
Mark Paluch
c73c0bfd6d Polishing.
Consistent wording for pageable and sort arguments.

See #2574
2022-03-18 15:09:16 +01:00
Diego Krupitza
1ea8d09b38 Update documentation for repository Pageable and Sort arguments.
Replace outdated `null` acceptance for `Pageable` with `Pageable.unpaged()`
 `QueryByExampleExecutor#findAll(Example<S> example, Pageable pageable)` should does not accept null values since there is `Pageable.unpaged()`. Furthermore, the same applies to `PagingAndSortingRepository#findAll(Pageable pageable)`.

Related ticket: spring-projects/spring-data-jpa/issues/2464
Closes #2574
2022-03-18 15:07:51 +01:00
Mark Paluch
dda102ad7f Polishing.
Increase visibility of converter builders.

Refine generics naming towards DV/SV instead of A/B to easier identify store-native values and domains-specific values in the API. Refactor PropertyValueConversions.hasValueConverter into a non-default method.

Tweak documentation.

See #1484
Original pull request: #2566.
2022-03-18 14:54:47 +01:00
Christoph Strobl
228431534f Refine API and property-converter documentation.
See #1484
Original pull request: #2566.
2022-03-18 14:54:37 +01:00
Oliver Drotbohm
e7292279bf Fluent registration API for PropertyValueConverters.
Introduce a builder API to register PropertyValueConverters using simple (Bi)Functions. Additional methods on ValueConversionContext to enable advanced use cases in converter implementation. Tweak generics of VCC to be able to expose store-specific PersistentProperty implementations via the context.

See #1484
Original pull request: #2566.
2022-03-18 14:54:17 +01:00
Christoph Strobl
caf49ad739 Add support for property-specific converters.
Closes #1484
Original pull request: #2566.
2022-03-18 14:54:15 +01:00
Mark Paluch
9a3a38dc22 Accept Object values in QuerydslPredicateBuilder.
We now accept Object-typed values to allow broader reuse of QuerydslPredicateBuilder. The conversion into the actual value considers the origin type and checks assignability before employing the ConversionService.

Closes #2573
2022-03-10 10:22:28 +01:00
Mark Paluch
8b3e4d44f0 Polishing.
Lazily make methods and fields accessible. Introduce invoke method to AnnotationDetectionMethodCallback.

See #2569
2022-03-02 14:54:33 +01:00
Mark Paluch
6bc28c118c Consider annotated methods in AnnotationRevisionMetadata.
We now detect annotated methods.

Closes #2569
2022-03-02 14:54:26 +01:00
Mark Paluch
8e241b1938 Update documentation of AbstractEntityInformation.
Align documentation with the code behavior as the behavior was changed but the documentation was not updated with the previous change.

Closes #2567
2022-03-02 08:52:37 +01:00
Mark Paluch
8f4ddc194b Clarify Javadoc for FallbackPageable in PageableHandlerMethodArgumentResolverSupport.
Closes #2551
2022-02-17 14:36:45 +01:00
Oliver Drotbohm
92d8de08e4 Simpler check to avoid primitive conversion in ConvertingPropertyAccessor.
We now use Spring's ClassUtils.isAssignable(…) directly. Unit tests to verify that conversion is skipped for primitive / boxed scenarios.

See #2546.
2022-02-17 14:36:45 +01:00
Christoph Strobl
01291619f4 Update copyright year to 2022.
See: #2552
2022-02-17 12:46:14 +01:00
Oliver Drotbohm
21777293cc AbstractPersistentProperty.isMap() now delegates to underlying TypeInformation.
Issue #2549
2022-02-16 15:53:57 +01:00
Oliver Drotbohm
557465bf0a Introduce standard DtoInstantiatingConverter.
Move simple Spring Converter implementation that allow to create DTOs from a source object previously copied amongst a variety of store modules.

Issue #2476.
2022-02-16 08:56:02 +01:00
Oliver Drotbohm
ac9f99fc54 Polishing of annotation model for object creators.
Move to @PersistenceCreator as canonical annotation to explicitly express constructors and methods to be used to create domain object instances from persistence operations. Removed @FactoryMethod as it's not needed anymore. @PersistenceConstructor is now deprecated.

Renamed EntityCreatorMetadata(Support|Discoverer) to InstanceCreatorMetadata(Support|Discoverer) to avoid further manifestation of the notion of an entity in the metamodel as it's not used to only handle entities.

Issue #2476.
2022-02-15 17:26:00 +01:00
Mark Paluch
c4a324e3cf Introduce support to create domain objects via factory methods.
Issue #2476.
2022-02-15 17:04:47 +01:00
Oliver Drotbohm
8bb88ffce1 Polishing.
Reorder methods according to conventions. More speaking names for the newly introduced type lookup methods.

Issue #2517.
2022-02-14 15:15:39 +01:00
nexx512
8d2a3466ef Fixed resolving generic types for Vavr maps.
Issue #2517.
2022-02-14 15:15:39 +01:00
Oliver Drotbohm
8ebe52dfd5 Complete Vavr collection detection on TypeInformation and CustomConversions.
Moved Vavr collection converters into a type in the utility package. Register the converters via CustomConversions.registerConvertersIn(…) to make sure that all the Spring Data object mapping converters automatically benefit from a ConversionService that is capable of translating between Java-native collections and Vavr ones.

Issue #2511.
2022-02-14 15:15:36 +01:00
nexx512
23c153aa55 Consider Vavr collections to be collection like in TypeInformation.
Issue #2511.
2022-02-14 14:45:57 +01:00
Mark Paluch
68bfa9af0e Performance improvements in ReactiveWrappers and ConvertingPropertyAccessor.
We now cache whether types are reactive wrappers and bypass the ConversionService for assignable primitive values.

Closes #2546
2022-02-11 15:22:03 +01:00
Mark Paluch
9146357b51 Polishing.
Let List… interface variants extend their base parent so that List-based variants participate in the type hierarchy.

See #2538
Original pull request: #2538.
2022-02-11 10:37:46 +01:00
Jens Schauder
f92a117b15 Add List-based repository interfaces.
This introduces the interfaces
* `ListCrudRepository`
* `ListQuerydslPredicateExecutor`
* `ListQueryByExampleExecutor`

They return `List` instead of `Iterable` when returning multiple entities.
They can be used in the same way the interfaces without the `List` prefix can be used.

Closes #2535.
Original pull request: #2538.
2022-02-11 10:37:35 +01:00
Jens Schauder
37eee0e35d Decouple Paging and Sorting repositories from CrudRepository.
This way they can be combined with different variants of CrudRepositories.

This affects
`PagingAndSortingRepository`, `ReactiveSortingRepository`, `CoroutineSortingRepository`, and `RxJavaSortingRepository`.

Any repository implementing those interfaces now needs to also implement a suitable CRUD repository, or needs to manually add the methods from a CRUD repository as needed.

Closes #2537
Original pull request: #2540.
2022-02-11 10:26:59 +01:00
Mark Paluch
ce9fcf9eb7 Refine PropertyReferenceException message.
Use single-quotes to indicate which elements belong to the underlying type and which are part of the textual message.

Closes #2395
2022-01-25 14:42:57 +01:00
yelis913
05260bf5d7 Add missing verb to the error message.
Closes #2524
2022-01-17 11:15:46 +01:00
Jens Schauder
38f50e3da8 Remove Eclipse Non-Javadoc comments.
Closes #2522
2022-01-13 18:51:02 +01:00
Mark Paluch
a56ef010da Remove own class reading infrastructure in favor of extensions to AnnotationMetadata.
We now remove fully our own class-reading visitors as AnnotationMetadata exposes getDeclaredMethods.
MethodsMetadataReaderFactory and MethodsMetadataReader remain deprecated bridging return types to retain backward compatibility.

Closes #2520
2022-01-13 18:49:23 +01:00
Christoph Strobl
2ee509b707 Remove invalid imports from types used for ASM metadata parsing.
See #2498
2022-01-13 18:49:23 +01:00
Mark Paluch
227c50b02d Introduce local copies of removed Spring Framework API for ASM metadata parsing.
Should be removed after revisiting our design.

See #2498
2022-01-13 18:49:23 +01:00
Mark Paluch
c735b58607 Migrate code to Java 17 style.
Use var instead of explicit local types where applicable. Use pattern variable instead instanceof and cast. Prefer loops and nullable types over Stream and Optional. Convert classes to records where applicable.

See #2465
2022-01-13 18:49:07 +01:00