Interface AggregatePath

All Superinterfaces:
Iterable<AggregatePath>

public interface AggregatePath extends 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
  • 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()
      Returns:
      true when this is references a List or Map.
    • 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 a root path.
      See Also:
    • getRequiredBaseProperty

      default RelationalPersistentProperty getRequiredBaseProperty()
      Returns:
      the base property.
      Throws:
      IllegalStateException - if the current path is a root path.
      See Also:
    • getRequiredLeafProperty

      default RelationalPersistentProperty getRequiredLeafProperty()
      Returns:
      the leaf property.
      Throws:
      IllegalStateException - if the current path is a root path.
      See Also:
    • getLeafEntity

      The RelationalPersistentEntity associated with the leaf of this path.
      Returns:
      Might return null when called on a path that does not represent an entity.
    • getRequiredLeafEntity

      default RelationalPersistentEntity<?> getRequiredLeafEntity()
      The RelationalPersistentEntity associated with the leaf of this path or throw IllegalStateException 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 using PersistentProperty.getName().
      Returns:
      will never be null.
    • getTableInfo

      default AggregatePath.TableInfo getTableInfo()
    • getColumnInfo

      default AggregatePath.ColumnInfo getColumnInfo()
    • filter

      @Nullable default AggregatePath filter(Predicate<? super AggregatePath> predicate)
      Filter the AggregatePath returning the first item matching the given Predicate.
      Parameters:
      predicate - must not be null.
      Returns:
      the first matching element or null.
    • stream

      default Stream<AggregatePath> stream()
      Creates a non-parallel Stream of the underlying Iterable.
      Returns:
      will never be null.
    • getIdDefiningParentPath

      AggregatePath getIdDefiningParentPath()
      Returns the longest ancestor path that has an Id 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