DATACMNS-867 - Second draft.

This commit is contained in:
Oliver Gierke
2016-06-21 16:52:28 +02:00
parent 57ed50a730
commit d4811e29d9
222 changed files with 2297 additions and 2138 deletions

View File

@@ -60,7 +60,7 @@ final class AnnotationAuditingMetadata {
static {
List<String> types = new ArrayList<String>(5);
List<String> types = new ArrayList<>(5);
types.add("org.joda.time.DateTime");
types.add("org.joda.time.LocalDateTime");
types.add(Date.class.getName());

View File

@@ -73,17 +73,16 @@ public class MappingAuditableBeanWrapperFactory extends DefaultAuditableBeanWrap
}
Class<?> type = it.getClass();
PersistentEntity<?, ?> entity = entities.getPersistentEntity(type);
if (entity == null) {
return super.getBeanWrapperFor(source);
}
return entities.getPersistentEntity(type).map(entity -> {
MappingAuditingMetadata metadata = metadataCache.computeIfAbsent(type,
foo -> new MappingAuditingMetadata(entity));
MappingAuditingMetadata metadata = metadataCache.computeIfAbsent(type,
key -> new MappingAuditingMetadata(entity));
return Optional.ofNullable(metadata.isAuditable()
? new MappingMetadataAuditableBeanWrapper(entity.getPropertyAccessor(it), metadata) : null);
return Optional.<AuditableBeanWrapper>ofNullable(metadata.isAuditable()
? new MappingMetadataAuditableBeanWrapper(entity.getPropertyAccessor(it), metadata) : null);
}).orElseGet(() -> super.getBeanWrapperFor(source));
});
}