Package org.springframework.data.mapping
Interface PersistentPropertyPath<P extends PersistentProperty<P>>
- All Superinterfaces:
Iterable<P>,Streamable<P>,Supplier<Stream<P>>
Abstraction of a path of
PersistentPropertys.- Author:
- Oliver Gierke, Johannes Englmeier
-
Method Summary
Modifier and TypeMethodDescriptionReturns the first property in thePersistentPropertyPath.Returns the sub-path of the current one as if it was based on the given base path.Returns the last property in thePersistentPropertyPath.intReturns the length of thePersistentPropertyPath.Returns the parent path of the currentPersistentPropertyPath, i.e. the path without the leaf property.default PDeprecated, for removal: This API element is subject to removal in a future version.booleanisBasePathOf(PersistentPropertyPath<P> path) Returns whether the givenPersistentPropertyPathis a base path of the current one.default booleanReturns whether the current path is located at the root of the traversal.Returns the dot based path notation usingPersistentProperty.getName().Returns the dot based path notation using the givenConverterto translate individualPersistentPropertys to path segments.Returns aStringpath with the given delimiter based on thePersistentProperty.getName().toPath(String delimiter, org.springframework.core.convert.converter.Converter<? super P, String> converter) Returns aStringpath with the given delimiter using the givenConverterforPersistentPropertyto String conversion.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
toDotPath
String toDotPath()Returns the dot based path notation usingPersistentProperty.getName().- Returns:
- will never be null.
-
toDotPath
Returns the dot based path notation using the givenConverterto translate individualPersistentPropertys to path segments.- Parameters:
converter- must not be null.- Returns:
- will never be null.
-
toPath
Returns aStringpath with the given delimiter based on thePersistentProperty.getName().- Parameters:
delimiter- must not be null or empty.- Returns:
- will never be null.
-
toPath
String toPath(String delimiter, org.springframework.core.convert.converter.Converter<? super P, String> converter) Returns aStringpath with the given delimiter using the givenConverterforPersistentPropertyto String conversion.- Parameters:
delimiter- must not be null.converter- must not be null.- Returns:
- will never be null.
-
getLeafProperty
P getLeafProperty()Returns the last property in thePersistentPropertyPath. So forfoo.barit will return thePersistentPropertyforbar. For a simplefooit returnsPersistentPropertyforfoo.- Returns:
- will never be null.
-
getRequiredLeafProperty
Deprecated, for removal: This API element is subject to removal in a future version.usegetLeafProperty()instead.Returns the last property in thePersistentPropertyPath. So forfoo.barit will return thePersistentPropertyforbar. For a simplefooit returnsPersistentPropertyforfoo.- Returns:
- will never be null.
-
getBaseProperty
P getBaseProperty()Returns the first property in thePersistentPropertyPath. So forfoo.barit will return thePersistentPropertyforfoo. For a simplefooit returnsPersistentPropertyforfoo.- Returns:
- will never be null.
-
isRootPath
default boolean isRootPath()Returns whether the current path is located at the root of the traversal. In other words, if the path only contains a single property.- Returns:
- whether the current path is located at the root of the traversal
-
isBasePathOf
Returns whether the givenPersistentPropertyPathis a base path of the current one. This means that the currentPersistentPropertyPathis basically an extension of the given one.- Parameters:
path- must not be null.- Returns:
- whether the given
PersistentPropertyPathis a base path of the current one.
-
getExtensionForBaseOf
Returns the sub-path of the current one as if it was based on the given base path. So for a current pathfoo.barand a given basefooit would returnbar. If the given path is not a base of the the current one the currentPersistentPropertyPathwill be returned as is.- Parameters:
base- must not be null.- Returns:
- will never be null.
-
getParentPath
Returns the parent path of the currentPersistentPropertyPath, i.e. the path without the leaf property. This happens up to the base property. So for a direct property reference calling this method will result in returning the property.- Returns:
- Throws:
IllegalStateException- if the current path only consists of one segment.
-
getLength
int getLength()Returns the length of thePersistentPropertyPath.- Returns:
- a value greater than 0.
-
getLeafProperty()instead.