diff --git a/src/main/java/org/springframework/data/mapping/PreferredConstructor.java b/src/main/java/org/springframework/data/mapping/PreferredConstructor.java index a01e462ef..41a1ea6f2 100644 --- a/src/main/java/org/springframework/data/mapping/PreferredConstructor.java +++ b/src/main/java/org/springframework/data/mapping/PreferredConstructor.java @@ -117,7 +117,7 @@ public class PreferredConstructor> { * {@link PersistentEntity} backing this {@link PreferredConstructor}. * * @param property must not be {@literal null}. - * @return + * @return {@literal true} if the {@link PersistentProperty} is used in the constructor. */ public boolean isConstructorParameter(PersistentProperty property) { @@ -147,7 +147,7 @@ public class PreferredConstructor> { * constructor argument of the enclosing class type. * * @param parameter must not be {@literal null}. - * @return + * @return {@literal true} if the {@link PersistentProperty} maps to the enclosing class. */ public boolean isEnclosingClassParameter(Parameter parameter) { @@ -210,6 +210,7 @@ public class PreferredConstructor> { this.hasSpelExpression = Lazy.of(() -> StringUtils.hasText(getSpelExpression())); } + @Nullable private static String getValue(Annotation[] annotations) { return Arrays.stream(annotations)// @@ -322,7 +323,7 @@ public class PreferredConstructor> { P referencedProperty = entity == null ? null : name == null ? null : entity.getPersistentProperty(name); - return property != null && property.equals(referencedProperty); + return property.equals(referencedProperty); } private boolean isEnclosingClassParameter() {