Commit Graph

1486 Commits

Author SHA1 Message Date
Mark Paluch
e4e677d6b1 DATACMNS-1140 - Polishing.
Extend javadoc. Remove trailing whitespaces.

Original pull request: #238.
2017-08-25 09:31:04 +02:00
Christoph Strobl
0ff4961853 DATACMNS-1140 - Open up Query by Example to allow extension in module implementations.
We turned Example and ExampleMatcher into interfaces with default implementations created via the static of methods. The default ExampleMatcher has strongly typed default implementation. This change allows store implementations to create their very own flavor of Example and ExampleMatcher allowing eg. non typed ones.

Original pull request: #238.
2017-08-25 09:28:54 +02:00
Oliver Gierke
d018757995 DATACMNS-1144 - @JsonPath now supports multiple path expressions.
Path expressions are now evaluated one by one with the first one actually available in the payload being used for value lookup. Also tweaked the default behavior to return null in case of an single, invalid path.
2017-08-24 12:56:19 +02:00
Oliver Gierke
ce7a2e8ea5 DATACMNS-1143 - Improve design of AbstractAggregateRoot.
Methods for domain event registration and access are now not following bean semantics anymore to avoid those accidentally leaking into formats that use the bean spec (e.g. Jackson to produce JSON).
2017-08-23 15:47:50 +02:00
Mark Paluch
fc402184e2 DATACMNS-1136 - Update reference documentation for composite repositories. 2017-08-14 16:56:23 +02:00
Oliver Gierke
fb9d38d79c DATACMNS-1139 - AbstractPersistentProperty.getRawType() now correctly resolves generics.
We're now favoring the generic TypeInformation over trying to resolve the property type via field or PropertyDescriptor as only the former does proper generic type resolution.
2017-08-14 14:06:16 +02:00
Oliver Gierke
fab854c906 DATACMNS-1138 - TypeInformation.specialize(…) now only specializes unresolved parameterized types.
Type specialization - i.e. enrichment of a raw type with a current generic context - is now only done if the current type is not yet resolved completely. This allows wildcarded target references to just fall back to the type to specialize, which will then by definition carry more generics information than the one to be specialized.
2017-08-11 16:15:54 +02:00
Oliver Gierke
756396a065 DATACMNS-1135 - Fixed generics lookup for recursively nested container references.
Revert the merging of a parent type's type variable map and only apply the locally available declared generics in case of parameterized types. Moved that augmentation into ParameterizedTypeInformation.
2017-08-03 15:39:54 +02:00
Mark Paluch
0ff80930a3 DATACMNS-1080 - Inject generated property accessor classes via ReflectUtils.defineClass(…).
We now use CGLibs ReflectUtils.defineClass(…) to inject classes into the entity's class loader instead of our own code. ReflectUtils itself discovers whether the class loader is encapsulated and falls back to Unsafe for class definition. We no longer require our own code so the evil class was removed.

Original pull request: #234.
2017-07-27 08:43:09 +02:00
Oliver Gierke
85fb08a797 DATACMNS-1127 - Updated changelog. 2017-07-27 00:48:48 +02:00
Mark Paluch
3c66ce423f DATACMNS-1077 - Remove RxJava1CrudRepository and RxJava1SortingRepository interfaces.
RxJava 1 development is phased out over time (Feature freeze in June 2017, EOL in March 2018) and we don't want to ship newly developed first-class support for libraries known to be no longer maintained. RxJava 1 type adoption support is not affected. Single and Observable can be still used in user-space code declaration, also copies of RxJava1CrudRepository (in user-space code) remain working.
2017-07-26 14:36:54 +02:00
Oliver Gierke
b86f42b9fb DATACMNS-1128 - After release cleanups. 2017-07-25 16:10:38 +02:00
Oliver Gierke
8768f31044 DATACMNS-1128 - Prepare next development iteration. 2017-07-25 16:10:33 +02:00
Oliver Gierke
986222ccc6 DATACMNS-1128 - Release version 2.0 RC2 (Kay). 2017-07-25 15:34:22 +02:00
Oliver Gierke
22e141b62d DATACMNS-1128 - Prepare 2.0 RC2 (Kay). 2017-07-25 15:33:32 +02:00
Oliver Gierke
1d30d1d628 DATACMNS-1128 - Updated changelog. 2017-07-25 15:33:17 +02:00
Oliver Gierke
6f44a40ecb DATACMNS-1129 - Polishing.
Formatting.
2017-07-25 13:52:16 +02:00
Oliver Gierke
7960786083 DATACMNS-1129 - A PartTree is now an empty iterable if no predicate is given. 2017-07-25 13:52:16 +02:00
Oliver Gierke
6c55d7e03b DATACMNS-1090 - After release cleanups. 2017-07-25 10:00:08 +02:00
Oliver Gierke
f039fb6b0c DATACMNS-1090 - Prepare next development iteration. 2017-07-25 10:00:02 +02:00
Oliver Gierke
631aff202c DATACMNS-1090 - Release version 2.0 RC1 (Kay). 2017-07-25 09:48:48 +02:00
Oliver Gierke
116ae703fc DATACMNS-1090 - Prepare 2.0 RC1 (Kay). 2017-07-25 09:48:00 +02:00
Oliver Gierke
96f0fd8e5c DATACMNS-1090 - Updated changelog. 2017-07-25 09:47:47 +02:00
Oliver Gierke
beebcf1f7c DATACMNS-1114 - Updated Javadoc of Sort.and(…) to match nullability requirements. 2017-07-24 23:03:58 +02:00
Oliver Gierke
83410752ae DATACMNS-1084 - Updated changelog. 2017-07-24 22:20:34 +02:00
Oliver Gierke
a53a331813 DATACMNS-1124 - Upgraded to Javaslang 2.0.6. 2017-07-24 14:17:44 +02:00
Oliver Gierke
af56889e72 DATACMNS-1123 - Upgraded to XmlBeam 1.4.12 and tweaked HttpMessageConverter implementation.
XmlBeam 1.4.11 accidentally removed ProjectionFactory as public interface. Adapted our HttpMessageConverter implementation to make sure we still work on those versions.

Related ticket: https://github.com/SvenEwald/xmlbeam/issues/45
2017-07-24 14:17:36 +02:00
Oliver Gierke
049970874d DATACMNS-1114 - Introduced usage of nullable annotations for API validation.
Marked all packages with Spring Frameworks @NonNullApi. Added Spring's @Nullable to methods, parameters and fields that take or produce null values. Adapted using code to make sure the IDE can evaluate the null flow properly. Fixed Javadoc in places where an invalid null handling policy was advertised. Strengthened null requirements for types that expose null-instances.

Removed null handling from converters for JodaTime and ThreeTenBP. Introduced factory methods Page.empty() and Page.empty(Pageable). Introduced default methods getRequiredGetter(), …Setter() and …Field() on PersistentProperty to allow non-nullable lookups of members. The same for TypeInformation.getrequiredActualType(), …SuperTypeInformation().

Tweaked PersistentPropertyCreator.addPropertiesForRemainingDescriptors() to filter unsuitable PropertyDescriptors before actually trying to create a Property instance from them as the new stronger nullability requirements would cause exceptions downstream.

Lazy.get() now expects a non-null return value. Clients being able to cope with null need to call ….orElse(…).

Original pull request: #232.
2017-07-24 10:47:28 +02:00
Oliver Gierke
d9b16d8a27 DATACMNS-1085 - Fixed typos in Javadoc.
Original pull request: #229.
2017-07-24 10:32:19 +02:00
Mark Paluch
86945f81d1 DATACMNS-1122 - Improve message for absent required property in PersistentEntity.getRequiredPersistentProperty(…).
Exception message now contains the property name.
2017-07-21 08:54:39 +02:00
Mark Paluch
013bda0dd2 DATACMNS-1118 - Inherit Project Reactor version from dependency management.
Adapt to BOM import in Spring Data Build pom.
2017-07-20 15:53:29 +02:00
Oliver Gierke
51f099306d DATACMNS-1121 - ProxyProjectionFactory now returns instance as is if it implements the target.
If you previously asked ProxyProjectionFactory for a proxy of an interface which the target instance already implements, it created a proxy although it could've returned the instance as is. It's now actually doing that avoiding superfluous proxy creation.
2017-07-20 14:29:54 +02:00
Oliver Gierke
5e4cac308e DATACMNS-1120 - Introduced caching of PropertyPath instances. 2017-07-20 13:38:43 +02:00
Oliver Gierke
75ac90150f DATACMNS-1119 - Cache for ClassTypeInformation is now a ConcurrentReferenceHashMap. 2017-07-20 12:56:11 +02:00
Oliver Gierke
7ee5ae446b DATACMNS-1117 - Fixed creation of RepositoryInformation in RepositoryFactoryBeanSupport.
RepositoryFactoryBeanSupport.getRepositoryInformation() previously didn't consider any store-specific compositions (incl. store-specific fragments like the Querydsl support) as it just handed a fragment with the custom implementation to RepositoryFactorySupport.

This is now fixed by improving the API in RepositoryFactorySupport which now exposes a getRepositoryInformation(RepositoryMetadata, RepositoryFragments) which creates a fresh RepositoryComposition from the given RepositoryMetadata. Intermediate setup methods are still kept around but private as RepositoryFactorySupport.getRepository(…) still needs to forward the base RepositoryComposition to method interceptors for query result mapping.
2017-07-20 10:14:57 +02:00
Oliver Gierke
dfcb9f77a4 DATACMNS-1116 - AbstractMappingContext now caches PersistentPropertyPaths.
As the calculation of a PersistentPropertyPath instances is rather expensive and they're heavily used in downstream mapping operations (e.g. query and fields mapping in MongoDB) we now cache the instances created per base type and property path.
2017-07-19 13:45:41 +02:00
Oliver Gierke
d692702663 DATACMNS-1115 - Improve RepositoryBeanNameGenerator to properly resolve bean names for indexed BeanDefinitions.
Previously, RepositoryBeanNameGenerator applied the custom bean name lookup if the BeanDefinition given was not a ScannedGenericBeanDefinition. That in turn had been the case for custom implementation classes that were obtained through classpath scanning. With Spring 5 an index file can be used by the scanner, which in turn will cause AnnotatedGenericBeanDefinition instances being returned. That caused the code path to lookup the first constructor argument to kick in (usually used to obtain the repository interface from repository factory beans) and cause a NullPointerException.

We now forward AnnotatedBeanDefinitions as is and only apply the custom lookup for everything else, i.e. the bean definitions used for the factories.
2017-07-19 01:28:58 +02:00
Oliver Gierke
d5728b6e3f DATACMNS-1113 - Deprecated MappingContext.getPersistentPropertyPath(InvalidPersistentPropertyPath).
Deprecated the additional method in favor if a lookup via MappingContext.getPersistentPropertyPath(PropertyPath) using the resolvable PropertyPath exposed by InvalidPersistentPropertyPath.
2017-07-17 16:09:28 +02:00
Oliver Gierke
6a6d995eab DATACMNS-1109 - Reinstantiate support for all date/time APIs in auditing.
Re-enabled test cases for handling of different date/time APIs in auditing. Tweaked the lookup of the last modified value to try to convert to LocalDateTime as well in case it's a subtype of the type requested. In combination with two newly introduced converters for local date type times in JodaTime and ThreeTenBP, this allows us to still convert legacy JodaTime and ThreeTenBP types to be used as well.
2017-07-12 19:17:23 +02:00
Oliver Gierke
d4b79ea8f2 DATACMNS-1112 - Cache instances of ReturnedType to avoid repeated reflection inspection.
We now keep instances of ReturnedType around to avoid the repeated reflection inspection for constructor and parameter name detection for class types and projection information for interfaces.
2017-07-12 17:09:39 +02:00
Oliver Gierke
4d2cc9ab8e DATACMNS-1110 - Introduced StreamUtils.createStreamFromIterator(CloseableIterator).
This is an overload for the already existing method taking a plain Iterator so that we only apply the close callback to the Stream in the newly introduced one.
2017-07-12 10:54:11 +02:00
Oliver Gierke
b724797dc6 DATACMNS-1107 - Polishing.
Moved methods around in ProjectionFactory implementations to follow the coding guidelines.
2017-07-11 11:23:37 +02:00
Oliver Gierke
6e09c09afa DATACMNS-1107 - ProxyProjectionFactory now caches ProjectionInformation instances.
To avoid the repeated scanning of projection interfaces for property descriptors we now cache the ProjectionInformation instances created via ProjectionFactory.getProjectionInformation(…). Adapted SpelAwareProxyProjectionFactory to now apply its customizations in newly introduced createProjectionInformation(…).
2017-07-11 11:23:05 +02:00
Oliver Gierke
8026e9ff72 DATACMNS-1106 - Removed deprecations in ProjectionFactory.
Removed the deprecated implementation of ResourceLoaderAware in favor of BeanClassLoaderAware. Removed deprecated ProjectionFactory.getInputProperties() in favor of ….getProjectionInformation(). Removed the Java conditional to add a MethodInterceptor for default methods. Adapted test cases.
2017-07-11 11:18:18 +02:00
Jens Schauder
023a0b2a38 DATACMNS-1104 - Changed scope of Degraph dependency to 'test’. 2017-07-07 08:38:37 +02:00
Oliver Gierke
24704fc4de DATACMNS-1097 - Polishing.
Updated Sonargraph architecture description. Polished imports in domain package to avoid unnecessary imports (mostly due to Javadoc references).

Removed manually declared constructor in ExampleMatcherAccessor in favor of Lombok's @RequiredArgsConstructor. Removed deprecations in type information subsystem. Moved to different way of class loading to avoid null pointer warnings in ReflectionUtils.
2017-07-06 11:38:12 +02:00
Jens Schauder
1fc25727cf DATACMNS-1097 - Move classes to better matching packages.
Introduced new ExampleMatcherAccessor in data.support in favor of the now deprecated one in data.repository.core to avoid a dependency into the repositories subsystem to work with examples in general.

Added Degraph based test in order to avoid future cyclic package dependency violations.

Original pull request: #230.
Related ticket: DATAMONGO-1721.
2017-07-06 11:38:12 +02:00
Oliver Gierke
f44255b9a8 DATACMNS-1102 - Reuse ConversionService in ProjectingMethodInterceptors created by ProxyProjectionFactory.
Applied the same to internals of MapDataBinder.
2017-07-05 09:41:21 +02:00
Mark Paluch
3dbbb15672 DATACMNS-1101 - Use dedicated type to cache custom conversion targets without requested target type.
We now use a marker interface to store cache hits for conversion targets without requesting a conversion target in the conversion query. The dedicated marker type has an individual cache view and does not interfere with other types.

Previously we used Object as cache key which caused false positives due to assignability checks. If an earlier conversion query with a requested target type yielded a hit (e.g. negative hit), subsequent queries without a target type received the same answer. This might happen although the non-cached answer would return a different result.
2017-07-04 14:30:45 +02:00
Christoph Strobl
f6a6565638 DATACMNS-1101 - Remove getPersistentProperties/Associations from PersistentEntity.
Remove lately introduced getPersistentProperties / getAssociations and rather extend Iterable<? extends PersistentProperty<P>>
2017-07-04 14:30:45 +02:00