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
PersistentProperty
s.- 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
.int
Returns the length of thePersistentPropertyPath
.Returns the parent path of the currentPersistentPropertyPath
, i.e. the path without the leaf property.default P
Deprecated, for removal: This API element is subject to removal in a future version.boolean
isBasePathOf
(PersistentPropertyPath<P> path) Returns whether the givenPersistentPropertyPath
is a base path of the current one.default boolean
Returns 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 givenConverter
to translate individualPersistentProperty
s to path segments.Returns aString
path with the given delimiter based on thePersistentProperty.getName()
.toPath
(String delimiter, org.springframework.core.convert.converter.Converter<? super P, String> converter) Returns aString
path with the given delimiter using the givenConverter
forPersistentProperty
to 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 givenConverter
to translate individualPersistentProperty
s to path segments.- Parameters:
converter
- must not be null.- Returns:
- will never be null.
-
toPath
Returns aString
path 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 aString
path with the given delimiter using the givenConverter
forPersistentProperty
to 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.bar
it will return thePersistentProperty
forbar
. For a simplefoo
it returnsPersistentProperty
forfoo
.- 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.bar
it will return thePersistentProperty
forbar
. For a simplefoo
it returnsPersistentProperty
forfoo
.- Returns:
- will never be null.
-
getBaseProperty
P getBaseProperty()Returns the first property in thePersistentPropertyPath
. So forfoo.bar
it will return thePersistentProperty
forfoo
. For a simplefoo
it returnsPersistentProperty
forfoo
.- 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 givenPersistentPropertyPath
is a base path of the current one. This means that the currentPersistentPropertyPath
is basically an extension of the given one.- Parameters:
path
- must not be null.- Returns:
- whether the given
PersistentPropertyPath
is 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.bar
and a given basefoo
it would returnbar
. If the given path is not a base of the the current one the currentPersistentPropertyPath
will 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.