From 773fb8026381aaba944ea6f78a2a9c2a0f8d84b1 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Wed, 28 Jun 2017 14:26:47 +0200 Subject: [PATCH] DATACMNS-1101 - Apply caching to frequently used flags in AnnotationBasedPersistentProperty. --- .../model/AnnotationBasedPersistentProperty.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/springframework/data/mapping/model/AnnotationBasedPersistentProperty.java b/src/main/java/org/springframework/data/mapping/model/AnnotationBasedPersistentProperty.java index e46cb8539..f5cf74c28 100644 --- a/src/main/java/org/springframework/data/mapping/model/AnnotationBasedPersistentProperty.java +++ b/src/main/java/org/springframework/data/mapping/model/AnnotationBasedPersistentProperty.java @@ -65,6 +65,11 @@ public abstract class AnnotationBasedPersistentProperty

isTransient = Lazy.of(() -> super.isTransient() || isAnnotationPresent(Transient.class) || isAnnotationPresent(Value.class) || isAnnotationPresent(Autowired.class)); + private final Lazy writable = Lazy.of(() -> !isTransient() && !isAnnotationPresent(ReadOnlyProperty.class)); + private final Lazy reference = Lazy.of(() -> !isTransient() && isAnnotationPresent(Reference.class)); + private final Lazy isId = Lazy.of(() -> isAnnotationPresent(Id.class)); + private final Lazy isVersion = Lazy.of(() -> isAnnotationPresent(Version.class)); + /** * Creates a new {@link AnnotationBasedPersistentProperty}. * @@ -173,7 +178,7 @@ public abstract class AnnotationBasedPersistentProperty