Interface AggregatePath
- All Superinterfaces:
Iterable<AggregatePath>
Represents a path within an aggregate starting from the aggregate root. The path can be iterated from the leaf to its
root.
- Since:
- 3.2
- Author:
- Jens Schauder, Mark Paluch
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic final record
static final record
-
Method Summary
Modifier and TypeMethodDescriptionappend
(RelationalPersistentProperty property) Creates a new path by extending the current path by the property passed as an argument.default AggregatePath
filter
(Predicate<? super AggregatePath> predicate) Filter the AggregatePath returning the first item matching the givenPredicate
.default AggregatePath.ColumnInfo
Returns the longest ancestor path that has anId
property.TheRelationalPersistentEntity
associated with the leaf of this path.default int
Returns the path length for the aggregate path.Returns the path that has the same beginning but is one segment shorter than this path.default RelationalPersistentProperty
default RelationalPersistentEntity<?>
TheRelationalPersistentEntity
associated with the leaf of this path or throwIllegalStateException
if the leaf cannot be resolved.default RelationalPersistentProperty
default AggregatePath.TableInfo
boolean
boolean
boolean
Returns true exactly when the path is non-empty and the leaf property an embedded one.boolean
isEntity()
boolean
isMap()
boolean
Returns true if there are multiple values for this path, i.e. if the path contains at least one element that is a collection and array or a map. // TODO: why does this return true if the parent entity is a collection?boolean
boolean
boolean
isRoot()
boolean
default Stream<AggregatePath>
stream()
Returns the dot based path notation usingPersistentProperty.getName()
.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
getParentPath
AggregatePath getParentPath()Returns the path that has the same beginning but is one segment shorter than this path.- Returns:
- the parent path. Guaranteed to be not null.
- Throws:
IllegalStateException
- when called on an empty path.
-
append
Creates a new path by extending the current path by the property passed as an argument.- Parameters:
property
- must not be null.- Returns:
- Guaranteed to be not null.
-
isRoot
boolean isRoot()- Returns:
- true if this is a root path for the underlying type.
-
getLength
default int getLength()Returns the path length for the aggregate path.- Returns:
- the path length for the aggregate path
-
isWritable
boolean isWritable() -
isEntity
boolean isEntity()- Returns:
- true when this is an empty path or the path references an entity.
-
isEmbedded
boolean isEmbedded()Returns true exactly when the path is non-empty and the leaf property an embedded one.- Returns:
- if the leaf property is embedded.
-
isMultiValued
boolean isMultiValued()Returns true if there are multiple values for this path, i.e. if the path contains at least one element that is a collection and array or a map. // TODO: why does this return true if the parent entity is a collection? This seems to mix some concepts that belong to somewhere else. // TODO: Multi-valued could be understood for embeddables with more than one column (i.e. composite primary keys)- Returns:
- true if the path contains a multivalued element.
-
isQualified
boolean isQualified() -
isMap
boolean isMap()- Returns:
- true if the leaf property of this path is a
Map
. - See Also:
-
isCollectionLike
boolean isCollectionLike()- Returns:
- true when this is references a
Collection
or an array.
-
isOrdered
boolean isOrdered()- Returns:
- whether the leaf end of the path is ordered, i.e. the data to populate must be ordered.
- See Also:
-
hasIdProperty
boolean hasIdProperty()- Returns:
- true if this path represents an entity which has an identifier attribute.
-
getRequiredIdProperty
RelationalPersistentProperty getRequiredIdProperty() -
getRequiredPersistentPropertyPath
PersistentPropertyPath<RelationalPersistentProperty> getRequiredPersistentPropertyPath()- Returns:
- the persistent property path if the path is not a
root
path. - Throws:
IllegalStateException
- if the current path is aroot
path.- See Also:
-
getRequiredBaseProperty
- Returns:
- the base property.
- Throws:
IllegalStateException
- if the current path is aroot
path.- See Also:
-
getRequiredLeafProperty
- Returns:
- the leaf property.
- Throws:
IllegalStateException
- if the current path is aroot
path.- See Also:
-
getLeafEntity
TheRelationalPersistentEntity
associated with the leaf of this path.- Returns:
- Might return null when called on a path that does not represent an entity.
-
getRequiredLeafEntity
TheRelationalPersistentEntity
associated with the leaf of this path or throwIllegalStateException
if the leaf cannot be resolved.- Returns:
- the required
RelationalPersistentEntity
associated with the leaf of this path. - Throws:
IllegalStateException
- if the persistent entity cannot be resolved.
-
toDotPath
String toDotPath()Returns the dot based path notation usingPersistentProperty.getName()
.- Returns:
- will never be null.
-
getTableInfo
-
getColumnInfo
-
filter
Filter the AggregatePath returning the first item matching the givenPredicate
.- Parameters:
predicate
- must not be null.- Returns:
- the first matching element or null.
-
stream
- Returns:
- will never be null.
-
getIdDefiningParentPath
AggregatePath getIdDefiningParentPath()Returns the longest ancestor path that has anId
property.- Returns:
- A path that starts just as this path but is shorter. Guaranteed to be not null. TODO: throws NoSuchElementException: No value present for empty paths
-