DATACMNS-638, DATACMNS-643 - Support for JSR-310 and ThreeTen datetime types.

Extend AuditableBeanWrapper to allow access to the last modification date of a target object. Made AuditableBeanWrapperFactory an interface and renamed what’s been previously known under this name as DefaultAuditableBeanWrapperFactory.

The components previously relying on a MappingContext to lookup a PersistentEntity now use PersistentEntities to be able to back a collection of MappingContexts behind that and also avoid unmanaged types to be added to the MappingContext.

We now also register the JSR-310 and ThreeTen back-port converters with the ConversionService to be able to get and set auditing dates as these types.
This commit is contained in:
Oliver Gierke
2015-02-04 19:30:02 +01:00
parent fe49e4cf14
commit 0c65c7bb67
17 changed files with 656 additions and 313 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012 the original author or authors.
* Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +15,8 @@
*/
package org.springframework.data.mapping.context;
import java.util.Arrays;
import org.springframework.data.mapping.PersistentEntity;
import org.springframework.data.mapping.PersistentProperty;
import org.springframework.data.mapping.PersistentPropertyAccessor;
@@ -34,17 +36,30 @@ import org.springframework.util.Assert;
*/
public class MappingContextIsNewStrategyFactory extends IsNewStrategyFactorySupport {
private final MappingContext<? extends PersistentEntity<?, ?>, ?> context;
private final PersistentEntities context;
/**
* Creates a new {@link MappingContextIsNewStrategyFactory} using the given {@link MappingContext}.
*
* @param context must not be {@literal null}.
* @deprecated use {@link MappingContextIsNewStrategyFactory(PersistentEntities)} instead.
*/
@Deprecated
@SuppressWarnings("unchecked")
public MappingContextIsNewStrategyFactory(MappingContext<? extends PersistentEntity<?, ?>, ?> context) {
this(new PersistentEntities(Arrays.asList(context)));
}
Assert.notNull(context, "MappingContext must not be null!");
this.context = context;
/**
* Creates a new {@link MappingContextIsNewStrategyFactory} using the given {@link PersistentEntities}.
*
* @param context must not be {@literal null}.
* @since 1.10
*/
public MappingContextIsNewStrategyFactory(PersistentEntities entities) {
Assert.notNull(entities, "PersistentEntities must not be null!");
this.context = entities;
}
/*