Commit Graph

1437 Commits

Author SHA1 Message Date
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
Christoph Strobl
88ac1fc165 DATACMNS-1101 - Polishing.
Move MappingException from o.s.d.mapping.model to o.s.d.mapping package and use it for getRequired* methods in MappingContext instead of throwing IllegalArgumentException. Further on we’ve consolidated usage of IllegalArgumentException and IllegalStateException. Along that IllegalMappingException was removed in favor or MappingException.

BasicPersistentEntity now looks up all properties by annotation instead of just returning the first one found. We’ve kept the original methods behavior and updated the comment as well as introduced getPersistentProperties returning all matching properties.
2017-07-04 14:30:45 +02:00
Oliver Gierke
09dd13c41a DATACMNS-1101 - Adapt API changes in PropertyAccessor from MappingAuditableBeanWrapperFactory.
We now avoid wrapping the value into an Optional as PropertyAccessor now takes Object as parameter right away.
2017-07-04 14:30:45 +02:00
Oliver Gierke
f78793ceeb DATACMNS-1101 - User method invocation over reference to avoid compiler error in Eclipse. 2017-07-04 14:30:45 +02:00
Mark Paluch
4a04251a81 DATACMNS-1101 - Reinstantiate assertions using Supplier. 2017-07-04 14:30:44 +02:00
Mark Paluch
5015b34a58 DATACMNS-1101 - Add caching for annotation-based property lookup. 2017-07-04 14:30:44 +02:00
Mark Paluch
0493d131e0 DATACMNS-1101 - Remove Optional from TypeDiscoverer API. 2017-07-04 14:30:44 +02:00
Mark Paluch
2064c72a85 DATACMNS-1101 - Remove Optional from PersistentProperty.getComponentType(…)/getMapValueType(…). 2017-07-04 14:30:44 +02:00
Mark Paluch
eb9854f18f DATACMNS-1101 - Cache positive and negative simple type hits. 2017-07-04 14:30:44 +02:00
Oliver Gierke
0e86470e36 DATACMNS-1101 - Remove Alias.ofOptional(…).
Refactored type alias detection invocation in BasicPersistentEntity into separate method and avoid the factory method Alias.ofOptional(…) so that it can be removed.
2017-07-04 14:30:44 +02:00
Mark Paluch
8c499122c7 DATACMNS-1101 - Alias is no longer based on Optional.
Remove internal Optional usage from Alias so it's a pure value object that does not create Optional instances during its usage.
2017-07-04 14:30:43 +02:00
Mark Paluch
78e8327d2d DATACMNS-1101 - Replace Stream usage in SimpleTypeHolder with loops.
Use loops to prevent Stream allocation in isSimpleType(…). Use WeakHashMap for type caching for improved contains(…) performance and GC behavior.
2017-07-04 14:30:43 +02:00
Mark Paluch
773fb80263 DATACMNS-1101 - Apply caching to frequently used flags in AnnotationBasedPersistentProperty. 2017-07-04 14:30:43 +02:00
Mark Paluch
17b82cfe37 DATACMNS-1101 - Use construction object array pooling.
Use a thread-local object pool for constructor arguments to reduce object allocations.
2017-07-04 14:30:43 +02:00
Mark Paluch
e6e3290e59 DATACMNS-1101 - Refactor CustomConversion to use two-level caching.
We now use a two-level cache instead of using a composite cache key to reduce object allocations.
2017-07-04 14:30:43 +02:00
Mark Paluch
6495a50df7 DATACMNS-1101 - Replace ArrayList indirections in ReflectionEntityInstantiator/PreferredConstructor.
Iterate over simple ArrayList and construct array of params instead of copying elements between multiple Lists.
2017-07-04 14:30:43 +02:00
Mark Paluch
b2ce4b8f1b DATACMNS-1101 - Use array to store map types in TypeDiscoverer.
Prevent iterator creation.
2017-07-04 14:30:43 +02:00
Mark Paluch
ce9aae49c8 DATACMNS-1101 - Use non-capturing lambdas in CustomConversions for conversion lookup. 2017-07-04 14:30:43 +02:00
Oliver Gierke
38d9b08132 DATACMNS-1101 - Ternary value assignment in AnnotationBasedPersistentProperty. 2017-07-04 14:30:43 +02:00
Mark Paluch
a15b25c9ef DATACMNS-1101 - Cache Value annotation value eagerly. 2017-07-04 14:30:42 +02:00
Mark Paluch
6c65c02e78 DATACMNS-1101 - Remove Optional from mapping/convert use except for caching of absence and computations that are used to populate caches. 2017-07-04 14:30:42 +02:00
Mark Paluch
74fbe13f54 DATACMNS-1101 - Reduce Optional usage in convert/mapping packages.
Reducing Optional usage that lies on hot code paths for object mapping.
2017-07-04 14:30:42 +02:00
Mark Paluch
4aa083377b DATACMNS-1101 - Iterate with BasicPersistentEntity.doWithProperties(…) over precomputed properties. 2017-07-04 14:30:42 +02:00
Oliver Gierke
c3c5e7e331 DATACMNS-1102 - Avoid superfluous recreation of ConversionService for projections.
For repository query methods with a dynamic projection parameter, the ResultProcessor is recreated with the type handed to the method. This results in recreation of the ProjectingConverter, which previously recreated a DefaultConversionService instance (for fallback conversions), which is rather expensive due to the reflection lookups checking for the presence of libraries on the classpath.

This is now avoided by using copying methods that reuse the initially created DefaultConversionService.
2017-07-02 21:37:02 +02:00
Oliver Gierke
8a0dffea67 DATACMNS-1098 - Polishing.
Removed obsolete Spring version check. Formatting.
2017-06-26 16:26:41 +02:00
Oliver Gierke
fce40e981c DATACMNS-1098 - RepositoryComponentScanner now exposes BeanDefinitionRegistry.
We now override ClassPathScanningCandidateComponentProvider's getRegistry() to make sure custom conditions on repository candidates can use the currently available BeanDefinitionRegistry in their implementations. To achieve that we forward the BeanDefinitionRegistry at hand through the configuration infrastructure (both XML and annotation side of things).
2017-06-26 16:26:41 +02:00
Oliver Gierke
6cd5f7c052 DATACMNS-1096 - Replaced references to Spring's Converter to JDK 8's Function in domain package.
Switched to use Optional<Object> to make nullability explicit. Keep the original ….convert(…) method around as deprecated default method so that clients can be migrated gradually.
2017-06-26 16:26:41 +02:00
Mark Paluch
a605e168fc DATACMNS-1091 - Polishing.
Extract patterns to constants. Add ticket id's to tests. Formatting, method names.

Original pull request: #228.
2017-06-23 08:46:15 +02:00
Jens Schauder
c5318a7f3a DATACMNS-1091 - Fixes sporadic test failures in tests for JSR-310 conversions.
We now use specified date formats for converting various date types to Strings and comparing them.

Before, in some cases toString() was used which strips trailing zeros, causing sporadic failures.

JDK9 changed the behaviour of Date related toString methods, making tests fail all the time.
Therefore this fix is required for executing tests with JDK9.

Original pull request: #228.
2017-06-23 08:46:02 +02:00
Oliver Gierke
97bd85e628 DATACMNS-1095 - Made ObjectInstantiator public to avoid IllegalAccessErrors.
ObjectInstantiator needs to be declared public as otherwise loading the implementation class fails as it doesn't have access to the (package) private interface in a different classloader.
2017-06-21 18:23:04 +02:00
Mark Paluch
a972f7d101 DATACMNS-1060 - After release cleanups. 2017-06-14 17:14:08 +02:00
Mark Paluch
4d8465ad33 DATACMNS-1060 - Prepare next development iteration. 2017-06-14 17:14:06 +02:00
Mark Paluch
495cc7bddf DATACMNS-1060 - Release version 2.0 M4 (Kay). 2017-06-14 17:03:48 +02:00
Mark Paluch
d9735a4367 DATACMNS-1060 - Prepare 2.0 M4 (Kay). 2017-06-14 17:03:00 +02:00
Mark Paluch
16def70b77 DATACMNS-1060 - Updated changelog. 2017-06-14 17:02:56 +02:00
Oliver Gierke
29dadc5431 DATACMNS-1060 - Re-add artifact version to make release tools work. 2017-06-14 17:01:28 +02:00
Oliver Gierke
a825a337d8 DATACMNS-1089 - Prepare upgrade to AssertJ 3.8.
Fully qualify call to ClassTypeInformation.from(…) as AssertJ 3.8 introduces a method that results in ambiguity in the static imports for from(null).
2017-06-14 14:06:10 +02:00
Oliver Gierke
663ae9b4bf DATACMNS-102 - Polishing.
Changed RepositoryConfiguration to return Streamable over Iterable. A couple of code reorganizations, suppression of raw type. Turned abstract helper classes into interfaces where possible. A couple of typos in JavaDoc.

Original pull request: #222.
2017-06-13 23:47:54 +02:00
Mark Paluch
92e8907030 DATACMNS-102 - Allow Repositories to be composed of an arbitrary number of implementation classes.
We now use RepositoryComposition as backing implementation for repository method calls to implementations. We now scan for repository fragments during the repository configuration phase. Fragment implementation candidates derive from the repository interface declaration, specifically the declared interfaces and their order. We scan the class path during fragment scan for each interface and add discovered fragments to the repository composition. The name of the implementation is derived from the simple name of the interface and the implementation suffix. Qualified fragments are top-level interface declarations that are not annotated with NoRepositoryBean. Inherited interfaces are not considered as fragment candidates.

We create a RepositoryComposition from the discovered fragments in the order of interface declaration in the repository interface and supply the composition to the actual repository creation.

Original pull request: #222.
2017-06-13 23:47:54 +02:00
Mark Paluch
5e123ad7df DATACMNS-102 - Remove trailing whitespaces.
Original pull request: #222.
2017-06-13 23:47:54 +02:00
Christoph Strobl
f913aa7439 DATACMNS-1063 - Polishing.
Add deleteById accepting Publisher and alter JavaDoc to be more explicit about illegal arguments.

Original Pull Request: #226
2017-06-13 19:42:23 +02:00
Mark Paluch
9f1af1fb09 DATACMNS-1063 - Accept Publisher in ReactiveCrudRepository findById(…) and existsById(…).
We now accept Publisher<T> instead of Mono<T> in findById(…) and existsById(…). Users of a ReactiveStreams-based framework are no longer required to perform Publisher to Mono-adoption themselves but can pass a Publisher directly. Both methods use the first emitted value to issue their queries. Additional values are not consumed from the stream.

Original Pull Request: #226
2017-06-13 19:34:51 +02:00
Oliver Gierke
f0fa12340a DATACMNS-764 - Documentation polish.
Related pull request: #201.
2017-06-13 17:31:24 +02:00
Christian Wiejack
13907152fb DATACMNS-1073 - Remove unnecessary generics from PagingAndSortingRepository.findAll(Pageable).
Original pull request: #220.
2017-06-13 13:05:46 +02:00
Oliver Gierke
dc30810936 DATACMNS-764 - Fix ClassLoader lookup in XmlRepositoryConfigurationSource.
As per @jhoeller's recommendation, we now use the ResourceLoader's ClassLoader instead of the bean ClassLoader exposed by the XmlReaderContext. The latter can apparently be null outside certain lifecycle phases.

Related pull request: #201.
2017-06-09 15:31:51 +02:00
Oliver Gierke
9462a5ba47 DATACMNS-764 - Java 8 polishing.
Use Streamable in configuration APIs for more efficient, lazy traversal of source lists. Introduced SelectionSet.of(…) to move away from constructors. Avoid the use of null in SelectionSet.

Original pull request: #201.
2017-06-09 13:53:09 +02:00
Jens Schauder
eec63cb11d DATACMNS-764 - Disambiguate custom repository implementation if necessary
When multiple repository implementations are found based on the class name, the one with a bean name matching the interfaces bean name + implementation postfix is picked. Includes support for CDI.

RepositoryBeanNameGenerator now no longer implements BeanNameGenerator since while it produces names it does not behave like the interface suggests, i.e. it can work without a BeanFactory in the first place. It now uses constructor injection and is package private.

Original pull request: #201.
2017-06-09 13:53:09 +02:00
Mark Paluch
628d71cf1f DATACMNS-1047 - Updated changelog. 2017-06-08 11:56:19 +02:00
Mark Paluch
0af5a4f6f1 DATACMNS-1046 - Updated changelog. 2017-06-07 12:23:34 +02:00
Oliver Gierke
976aeaf34c DATACMNS-1074 - Polishing.
Java-8-ification.

Original pull request: #221.
2017-06-07 10:45:04 +02:00