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:
Oliver Gierke
2013-10-10 12:54:24 +02:00
parent 2d699b6b36
commit 06c2f41584
3 changed files with 59 additions and 12 deletions

View File

@@ -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;
}