Commit Graph

1311 Commits

Author SHA1 Message Date
Oliver Gierke
bc28a6b094 DATACMNS-867 - Improvements in Chunk and PageImpl.
Chunk now rejects null Pageables. Improved total calculation in PageImpl by using ….toOptional().
2017-03-24 08:00:47 +01:00
Oliver Gierke
93bb3d2e21 DATACMNS-867 - Additional assertions in AuditingHandler. 2017-03-24 08:00:47 +01:00
Oliver Gierke
7ac12c3c3d DATACMNS-867 - BasicPersistentEntity now rejects null Association.
Related ticket: DATACMNS-934.
2017-03-24 08:00:47 +01:00
Oliver Gierke
429dcbf659 DATACMNS-867 - ReflectionRepositoryInvoker now avoids ConversionService for Optional creation.
We now manually create Optional instances as the ConversionService converts single-argument collections into an optional with only that element.
2017-03-24 08:00:47 +01:00
Oliver Gierke
fe5d543ff2 DATACMNS-867 - Further refinements to Optionals.
Made ifAllPresent(…) void as the returned value is never used. Added ifPresentOrElse(…).
2017-03-24 08:00:47 +01:00
Oliver Gierke
d65d5a45e5 DATACMNS-867 - Fixed type on Sort.isUnsorted(). 2017-03-24 08:00:47 +01:00
Oliver Gierke
58b2bde303 DATACMNS-867 - Removed Optionals from Auditing methods signatures. 2017-03-24 08:00:46 +01:00
Oliver Gierke
ba875187cd DATACMNS-867 - RepositoryInvoker.invokeQueryMethod(…) now returns an Optional. 2017-03-24 08:00:46 +01:00
Oliver Gierke
7c33bcf98a DATACMNS-867 - Let lookups for a property's component and map value type use Optional. 2017-03-24 08:00:46 +01:00
Oliver Gierke
1c45fcfcdc DATACMNS-867 - Lazify lookups in AbstractPersistentProperty. 2017-03-24 08:00:46 +01:00
Oliver Gierke
417e728e77 DATACMNS-867 - Moved to new factory methods for Sort.
Codebase now uses Sort.by(…) where possible instead of the deprecated new Sort(…).
2017-03-24 08:00:46 +01:00
Oliver Gierke
fee153f724 DATACMNS-867 - RepositoryInvoker now returns an Optional for invokeFindOne(…).
Adapted ReflectionRepositoryInvoker to transparently unwrap other potentially used wrapper types to then convert the result into an Optional.
2017-03-24 08:00:46 +01:00
Oliver Gierke
dec820d6c2 DATACMNS-867 - Removed handling of null Pageables.
Pageable now exposes a dedicated null-object representing the absence of pagination so that all places that previously handled null values can now rather be more relaxed and assume that a non-null value is given.
2017-03-24 08:00:46 +01:00
Oliver Gierke
917c3e2889 DATACMNS-867 - Removed Optional from QuerydslBindingsFactory API. 2017-03-24 08:00:45 +01:00
Oliver Gierke
9b4188bfe8 DATACMNS-867 - Further AssertJ migrations. 2017-03-24 08:00:45 +01:00
Oliver Gierke
082c4157d1 DATACMNS-867 - Less Optional for auditing subsystem.
Removed Optional<Object> parameters in favor of plain Object and clients that avoid calling methods for absent values in the first place.
2017-03-24 08:00:45 +01:00
Oliver Gierke
5f7d1ae2f2 DATACMNS-867 - Overhaul of PersistentEntity API.
Moved getRequired…(…) methods from implementations into interfaces so that implementations inherit them by default.

Expanded generics declaration in PersistentEntities so that PerisistentProperty instances can be properly access from the PersistentEntity instances returned.
2017-03-24 08:00:45 +01:00
Oliver Gierke
1c60ea8d36 DATACMNS-867 - Rework utility classes.
Removed the additional methods that reflectively checked for the Stream type and whether a Method instance is a default method. Turned utility classes into interfaces where possible. Make use of Lombok's @UtilityClass where not.

Removed obsolete implementation class in StreamUtils in favor of a lambda.
2017-03-24 08:00:45 +01:00
Oliver Gierke
6e3114f3cb DATACMNS-867 - Updates to QueryExecutionConverters.
Introduced an overload in AbstractWrapperTypeConverter to simplify the constructors in implementations. Switched to Streamable.map(…) in getConvertibleTypes().
2017-03-24 08:00:45 +01:00
Oliver Gierke
628dc8b9c8 DATACMNS-867 - Introduced monadic methods on Streamable.
Streamable now exposes map(…), flatMap(…) and filter(…) to allow easy conversion into new Streamables. Introduced LazyStreamable to back those implementations. Simplified implementation of methods in PartTree to use those new methods.

Changed Page and Slice map(…) method to take a Function over a Converter so that act as specialization of the newly introduced map(…) method.
2017-03-24 08:00:45 +01:00
Oliver Gierke
133e46f6b4 DATACMNS-867 - Test updates after latest rebase. 2017-03-24 08:00:44 +01:00
Oliver Gierke
bdbdb46adb DATACMNS-867 - API updates after rebase on latest changes. 2017-03-24 08:00:44 +01:00
Oliver Gierke
e861d0343b DATACMNS-867 - Additions to Lazy.
Added mapping functions to Lazy.
2017-03-24 08:00:44 +01:00
Oliver Gierke
8372e34adf DATACMNS-867 - Cleanups in Pageable API.
Dropped Pageable.NONE in favor of ….unpaged() for consistency with Sort.unsorted(). Extracted the implementation for the value backing it into an Unpaged enum instance. Introduced defaulted isPaged() / isUnpaged() to avoid having to compare instances.

JavaDoc in Sort and a couple of API polishes.
2017-03-24 08:00:44 +01:00
Oliver Gierke
a5c4be5f0a DATACMNS-867 - Removed Optional from ResultProcessor.withDynamicProjection(…).
We now expect the PropertyAccessor to either be non-null or the method not being called at all.
2017-03-24 08:00:44 +01:00
Oliver Gierke
c84e6c8427 DATACMNS-867 - More required metadata lookup.
Introduced overloads to lookup required RepositoryInformation and PersistentEntity instances to Repositories and PersistentEntities.
2017-03-24 08:00:44 +01:00
Christoph Strobl
be347eaaab DATACMNS-867 - Additional Java 8 language feature cleanup.
Make use of lambdas and method references though out the codebase. Remove no longer required generic type parameters.
Additionally remove unused imports and replace single element list initialization with dedicated singletonList.
Use Assertion overloads taking Supplier for dynamic assertion error messages.
2017-03-24 08:00:43 +01:00
Christoph Strobl
aa4c51e1ea DATACMNS-867 - Cache constructors in ClassGeneratingPropertyAccesssorFactory.
Fix hotspot in constructor lookup - in particular the propertyAccessorClass.getConstructors() call.
Additionally fix another minor issue in assertion message creation.
2017-03-24 08:00:43 +01:00
Christoph Strobl
d363e8f2c2 DATACMNS-867 - Favor LocalDateTime over ZonedDateTime in CurrentDateTimeProvider.
Use LocalDateTime to avoid timezone issues just because the default auditing cannot handle it when the domain type property comes from eg. jodatime.
2017-03-24 08:00:43 +01:00
Mark Paluch
378baba06a DATACMNS-867 - Use Optional in AbstractQueryCreator to handle ParameterAccessor presence.
AbstractQueryCreator now requires constructor arguments and no longer permits passing null values for ParameterAccessor. ParameterAccessor is wrapped in Optional to correctly handle its presence and absence without dealing with null values.
2017-03-24 08:00:43 +01:00
Christoph Strobl
8bcd8cb3da DATACMNS-867 - Fixed glitch causing failure in PropertyDescriptor lookup for ProjectionInformation.
Re added PropertyDescriptor collection. Looks like the method got dropped during one of the rebase operations.
Additionally make use of .distinct() name collection in tests as descriptors might appear multiple times for the same property name.
2017-03-24 08:00:43 +01:00
Oliver Gierke
cc1c07ecca DATACMNS-867 - Hacking. 2017-03-24 08:00:43 +01:00
Christoph Strobl
47e2e61ff5 DATACMNS-867 - Preserve underscores when resolving PropertyPath for PersistentProperties.
Preserve underscores in variable names (eg. String foo_bar) when resolving the actual type information for the property via PropertyPath by quoting (Pattern#quote) the property name.
2017-03-24 08:00:43 +01:00
Mark Paluch
2da5acc553 DATACMNS-981 - Consider merged annotations when populating for annotation cache.
We now consider property annotations as merged annotations when initially scanning for annotations in a property declaration. Composed annotations such as declared outside our code are captured correctly because they use an own type that is not queried by users of PersistentProperty. Own, revised annotations, using @AliasFor providing an alias for annotation values require merged annotation processing.

Previously, annotations were cached as-is without resolving @AliasFor. This caused a later lookup via findAnnotation(…) to return the cached annotation without aliasing. Because the annotation was cached, no further lookup via AnnotatedElementUtils.findMergedAnnotation(…) was attempted.

@Retention(RetentionPolicy.RUNTIME)
@Target(value = { FIELD, METHOD })
public @interface RevisedAnnnotationWithAliasFor {

	@AliasFor("value")
	String name() default "";

	@AliasFor("name")
	String value() default "";
}

public class Person {
	@RevisedAnnnotationWithAliasFor(value = "spring")
	String firstname;
}

PersistentProperty firstname = …

property.findAnnotation(…) returned previously @RevisedAnnnotationWithAliasFor(value = "spring", name = "")

now we return @RevisedAnnnotationWithAliasFor(value = "spring", name = "spring")
2017-03-24 08:00:43 +01:00
Christoph Strobl
bab5ddade9 DATACMNS-867 - ReflectionEntityInformation getId(Object) considers potential null values. 2017-03-24 08:00:42 +01:00
Mark Paluch
6e0596694d DATACMNS-867 - Post-rebase changes.
Adopt tests to AssertJ. Remove superflous Mockito stubbing.
2017-03-24 08:00:42 +01:00
Oliver Gierke
250b1cf613 DATACMNS-867 - Cleanups in Querydsl support. 2017-03-24 08:00:42 +01:00
Oliver Gierke
282881a64c DATACMNS-867 - Removed obsolete reference to Environment from @EnableSpringDataWebSupport. 2017-03-24 08:00:42 +01:00
Oliver Gierke
9c6f764131 DATACMNS-867 - Consistent non-capitalization of Querydsl. 2017-03-24 08:00:42 +01:00
Oliver Gierke
2210f2e8e9 DATACMNS-867 - Adapt codebase after rebase on forward ports. 2017-03-24 08:00:36 +01:00
Christoph Dreis
9b3dd05baa DATACMNS-867 - Avoid allocations from Method.getParameterTypes() where possible.
We now prefer an explicit Method.getParameterCount() over accessing the parameter types array and its length to avoid the overhead of cloning the array.

Original pull request: #187.
2017-03-24 08:00:26 +01:00
Oliver Gierke
1ad82cb82d DATACMNS-867 - Update forward ported code.
Polished method lookup in DefaultRepositoryInformation using Optionals.firstNonEmpty(…). Optimized creation of JavaSlang's Option type as we don't have to rely on reflection to call static methods on interfaces on Java 8. AssertJ updates in corresponding tests.
2017-03-24 08:00:26 +01:00
Oliver Gierke
2d282b2d7f DATACMNS-867 - Cleanups. 2017-03-24 08:00:26 +01:00
Mark Paluch
798bbc3b0c DATACMNS-867 - Fix generic type matching for reactive repository base method discovery.
Base method discovery is now aligned with blocking base method discovery to consider type variables in parameter assignability checking.

Related ticket: DATACMNS-836.
2017-03-24 08:00:26 +01:00
Mark Paluch
7c31d9916a DATACMNS-867 - Simplify base method matching. 2017-03-24 08:00:26 +01:00
Oliver Gierke
dba5308d79 DATACMNS-867 - Removed conditional guards for the presence of TransactionalProxy.
TransactionalProxy is now available on the classpath by definition, so we don't need the guards anymore.
2017-03-24 08:00:26 +01:00
Oliver Gierke
bdd55fc7ab DATACMNS-867 - Java 8 polish of ReflectiveRepositoryInformation.
Introduced Optionals.firstNonEmpty(…) to consume a set of Suppliers until one returns a non-empty Optional.
2017-03-24 08:00:25 +01:00
Oliver Gierke
d7340e391c DATACMNS-867 - Further fixes. 2017-03-24 08:00:25 +01:00
Oliver Gierke
615b6548e8 DATACMNS-867 - Ported tests for reactive support to AssertJ. 2017-03-24 08:00:25 +01:00
Oliver Gierke
fd2c400c4e DATACMNS-867 - Optionals in CrudMethods API. 2017-03-24 08:00:25 +01:00