DATACMNS-380 - MappingContext exposes PersistentPropertyPath by dot path.
Introduced MappingContext.getPersistentPropertyPath(String, Class<?>) to allow looking up a PersistentPropertyPath from a plain dot-notated path expression (e.g. foo.bar.foobar). This removes the need to use a PropertyPath in case you really only want to look up plain path expressions and the additional functionality in PropertyPath (camel case traversal and interpreting _ as hard delimiter) is not needed or wanted.
This commit is contained in:
@@ -171,6 +171,20 @@ public class AbstractMappingContextUnitTests {
|
||||
assertThat(propertyEntity.getType(), is(equalTo((Class) Person.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-380
|
||||
*/
|
||||
@Test
|
||||
public void returnsPersistentPropertyPathForDotPath() {
|
||||
|
||||
PersistentPropertyPath<SamplePersistentProperty> path = context.getPersistentPropertyPath("persons.name",
|
||||
Sample.class);
|
||||
|
||||
assertThat(path.getLength(), is(2));
|
||||
assertThat(path.getBaseProperty().getName(), is("persons"));
|
||||
assertThat(path.getLeafProperty().getName(), is("name"));
|
||||
}
|
||||
|
||||
class Person {
|
||||
String name;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user