DATACMNS-562 - AbstractPersistentProperty doesn't consider maps and collections entities anymore.
The type detection for entity candidates of PersistentProperty instances now consistently handles collection types even if they're used als collection or map values.
This commit is contained in:
@@ -26,6 +26,7 @@ import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -260,6 +261,17 @@ public class AbstractPersistentPropertyUnitTests {
|
||||
assertThat(property.isEntity(), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-562
|
||||
*/
|
||||
@Test
|
||||
public void doesNotConsiderPropertyWithTreeMapMapValueAnEntity() {
|
||||
|
||||
SamplePersistentProperty property = getProperty(TreeMapWrapper.class, "map");
|
||||
assertThat(property.getPersistentEntityType(), is(emptyIterable()));
|
||||
assertThat(property.isEntity(), is(false));
|
||||
}
|
||||
|
||||
private <T> SamplePersistentProperty getProperty(Class<T> type, String name) {
|
||||
|
||||
BasicPersistentEntity<T, SamplePersistentProperty> entity = new BasicPersistentEntity<T, SamplePersistentProperty>(
|
||||
@@ -401,4 +413,8 @@ public class AbstractPersistentPropertyUnitTests {
|
||||
Map<String, Person> personMap;
|
||||
Collection<String> strings;
|
||||
}
|
||||
|
||||
class TreeMapWrapper {
|
||||
TreeMap<String, TreeMap<String, String>> map;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user