association) { - - Assert.notNull(association, "Association must not be null"); - - associations.add(association); - } - @Override @Nullable public P getPersistentProperty(String name) { @@ -306,27 +323,29 @@ private List
doFindPersistentProperty(Class extends Annotation> annotationT .filter(it -> it.isAnnotationPresent(annotationType)).collect(Collectors.toList()); } + @Override + public void addAssociation(Association
association) {
+
+ Assert.notNull(association, "Association must not be null");
+
+ associations.add(association);
+ }
+
+ @Override
public Class handler) {
-
- Assert.notNull(handler, "PropertyHandler must not be null");
-
- for (P property : persistentPropertiesCache) {
- handler.doWithPersistentProperty(property);
- }
- }
-
@Override
public void doWithProperties(SimplePropertyHandler handler) {
@@ -337,20 +356,22 @@ public void doWithProperties(SimplePropertyHandler handler) {
}
}
- public void doWithAssociations(AssociationHandler handler) {
+ @Override
+ public void doWithProperties(PropertyHandler handler) {
- Assert.notNull(handler, "Handler must not be null");
+ Assert.notNull(handler, "PropertyHandler must not be null");
- for (Association association : associations) {
- handler.doWithAssociation(association);
+ for (P property : persistentPropertiesCache) {
+ handler.doWithPersistentProperty(property);
}
}
- public void doWithAssociations(SimpleAssociationHandler handler) {
+ @Override
+ public void doWithAssociations(AssociationHandler handler) {
Assert.notNull(handler, "Handler must not be null");
- for (Association extends PersistentProperty>> association : associations) {
+ for (Association association : associations) {
handler.doWithAssociation(association);
}
}
@@ -373,11 +394,13 @@ private Optional doFindAnnotation(Class annotationT
it -> Optional.ofNullable(AnnotatedElementUtils.findMergedAnnotation(getType(), it)));
}
- public void verify() {
+ @Override
+ public void doWithAssociations(SimpleAssociationHandler handler) {
- if (comparator != null) {
- properties.sort(comparator);
- persistentPropertiesCache.sort(comparator);
+ Assert.notNull(handler, "Handler must not be null");
+
+ for (Association extends PersistentProperty>> association : associations) {
+ handler.doWithAssociation(association);
}
}
@@ -471,16 +494,13 @@ protected EvaluationContext getEvaluationContext(Object rootObject, ExpressionDe
return evaluationContextProvider.getEvaluationContext(rootObject, dependencies);
}
- /**
- * Returns the default {@link IsNewStrategy} to be used. Will be a {@link PersistentEntityIsNewStrategy} by default.
- * Note, that this strategy only gets used if the entity doesn't implement {@link Persistable} as this indicates the
- * user wants to be in control over whether an entity is new or not.
- *
- * @return
- * @since 2.1
- */
- protected IsNewStrategy getFallbackIsNewStrategy() {
- return PersistentEntityIsNewStrategy.of(this);
+ @Override
+ public void verify() {
+
+ if (comparator != null) {
+ properties.sort(comparator);
+ persistentPropertiesCache.sort(comparator);
+ }
}
/**
@@ -496,20 +516,15 @@ private void verifyBeanType(Object bean) {
}
/**
- * Calculates the {@link Alias} to be used for the given type.
+ * Returns the default {@link IsNewStrategy} to be used. Will be a {@link PersistentEntityIsNewStrategy} by default.
+ * Note, that this strategy only gets used if the entity doesn't implement {@link Persistable} as this indicates the
+ * user wants to be in control over whether an entity is new or not.
*
- * @param type must not be {@literal null}.
- * @return
+ * @return the fallback {@link IsNewStrategy}.
+ * @since 2.1
*/
- private static Alias getAliasFromAnnotation(Class> type) {
-
- TypeAlias typeAlias = AnnotatedElementUtils.findMergedAnnotation(type, TypeAlias.class);
-
- if (typeAlias != null && StringUtils.hasText(typeAlias.value())) {
- return Alias.of(typeAlias.value());
- }
-
- return Alias.empty();
+ protected IsNewStrategy getFallbackIsNewStrategy() {
+ return PersistentEntityIsNewStrategy.of(this);
}
/**
@@ -546,6 +561,7 @@ private static final class AssociationComparator
this.delegate = delegate;
}
+ @Override
public int compare(@Nullable Association left, @Nullable Association right) {
if (left == null) {
diff --git a/src/main/java/org/springframework/data/mapping/model/KotlinValueUtils.java b/src/main/java/org/springframework/data/mapping/model/KotlinValueUtils.java
index 3972b3d3b4..86d867e6e2 100644
--- a/src/main/java/org/springframework/data/mapping/model/KotlinValueUtils.java
+++ b/src/main/java/org/springframework/data/mapping/model/KotlinValueUtils.java
@@ -287,7 +287,7 @@ public Class> getParameterType() {
}
/**
- * @return {@code true} if the value hierarchy applies boxing.
+ * @return {@literal true} if the value hierarchy applies boxing.
*/
public boolean appliesBoxing() {
return applyBoxing;
diff --git a/src/main/java/org/springframework/data/mapping/model/PersistentEntityParameterValueProvider.java b/src/main/java/org/springframework/data/mapping/model/PersistentEntityParameterValueProvider.java
index 2124ff9c51..0a7fa385f5 100644
--- a/src/main/java/org/springframework/data/mapping/model/PersistentEntityParameterValueProvider.java
+++ b/src/main/java/org/springframework/data/mapping/model/PersistentEntityParameterValueProvider.java
@@ -42,7 +42,7 @@ public class PersistentEntityParameterValueProvider entity, PropertyValueProvider provider,
- Object parent) {
+ @Nullable Object parent) {
this.entity = entity;
this.provider = provider;
this.parent = parent;
@@ -53,6 +53,7 @@ private static Object getTransientDefault(Class> parameterType) {
return parameterType.isPrimitive() ? ReflectionUtils.getPrimitiveDefault(parameterType) : null;
}
+ @Override
@Nullable
@SuppressWarnings("unchecked")
public