DATACMNS-1199 - Added PropertyPath.nested(…).

This allows to obtain a nested property path based on a currently available one.
This commit is contained in:
Oliver Gierke
2017-10-19 12:40:53 +02:00
parent b3e1601bc6
commit 4bd8a3cfc3
2 changed files with 29 additions and 0 deletions

View File

@@ -195,6 +195,21 @@ public class PropertyPath implements Streamable<PropertyPath> {
return isCollection;
}
/**
* Returns the {@link PropertyPath} for the path nested under the current property.
*
* @param path must not be {@literal null} or empty.
* @return will never be {@literal null}.
*/
public PropertyPath nested(String path) {
Assert.hasText(path, "Path must not be null or empty!");
String lookup = toDotPath().concat(".").concat(path);
return PropertyPath.from(lookup, owningType);
}
/*
* (non-Javadoc)
* @see java.lang.Iterable#iterator()