Skip to content

Commit 2177729

Browse files
committed
AbstractPersistentProperty.isMap() now delegates to underlying TypeInformation.
Issue #2549
1 parent 557465b commit 2177729

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/main/java/org/springframework/data/mapping/model/AbstractPersistentProperty.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import java.lang.reflect.Modifier;
2121
import java.util.Collections;
2222
import java.util.HashSet;
23-
import java.util.Map;
2423
import java.util.Optional;
2524
import java.util.Set;
2625
import java.util.stream.Collectors;
@@ -229,7 +228,7 @@ public boolean isCollectionLike() {
229228

230229
@Override
231230
public boolean isMap() {
232-
return Map.class.isAssignableFrom(getType());
231+
return information.isMap();
233232
}
234233

235234
@Override

src/test/java/org/springframework/data/mapping/model/AbstractPersistentPropertyUnitTests.java

+12
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,14 @@ void detectsJMoleculesAssociation() {
238238
.containsExactly((Class) JMoleculesAggregate.class);
239239
}
240240

241+
@Test // #2549
242+
void considersVavrMaps() {
243+
244+
SamplePersistentProperty property = getProperty(VavrWrapper.class, "vavrMap");
245+
246+
assertThat(property.isMap()).isTrue();
247+
}
248+
241249
private <T> BasicPersistentEntity<T, SamplePersistentProperty> getEntity(Class<T> type) {
242250
return new BasicPersistentEntity<>(ClassTypeInformation.from(type));
243251
}
@@ -399,4 +407,8 @@ class JMolecules {
399407
interface JMoleculesAggregate extends AggregateRoot<JMoleculesAggregate, Identifier> {
400408

401409
}
410+
411+
class VavrWrapper {
412+
io.vavr.collection.Map<String, String> vavrMap;
413+
}
402414
}

0 commit comments

Comments
 (0)