Interface PersistentPropertyPath<P extends PersistentProperty<P>>

All Superinterfaces:
Iterable<P>, Streamable<P>, Supplier<Stream<P>>

public interface PersistentPropertyPath<P extends PersistentProperty<P>> extends Streamable<P>
Abstraction of a path of PersistentPropertys.
Author:
Oliver Gierke, Johannes Englmeier
  • Method Details

    • toDotPath

      String toDotPath()
      Returns the dot based path notation using PersistentProperty.getName().
      Returns:
      will never be null.
    • toDotPath

      String toDotPath(org.springframework.core.convert.converter.Converter<? super P,String> converter)
      Returns the dot based path notation using the given Converter to translate individual PersistentPropertys to path segments.
      Parameters:
      converter - must not be null.
      Returns:
      will never be null.
    • toPath

      String toPath(String delimiter)
      Returns a String path with the given delimiter based on the PersistentProperty.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 a String path with the given delimiter using the given Converter for PersistentProperty 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 the PersistentPropertyPath. So for foo.bar it will return the PersistentProperty for bar. For a simple foo it returns PersistentProperty for foo.
      Returns:
      will never be null.
    • getRequiredLeafProperty

      @Deprecated(since="3.1", forRemoval=true) default P getRequiredLeafProperty()
      Deprecated, for removal: This API element is subject to removal in a future version.
      use getLeafProperty() instead.
      Returns the last property in the PersistentPropertyPath. So for foo.bar it will return the PersistentProperty for bar. For a simple foo it returns PersistentProperty for foo.
      Returns:
      will never be null.
    • getBaseProperty

      P getBaseProperty()
      Returns the first property in the PersistentPropertyPath. So for foo.bar it will return the PersistentProperty for foo. For a simple foo it returns PersistentProperty for foo.
      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

      boolean isBasePathOf(PersistentPropertyPath<P> path)
      Returns whether the given PersistentPropertyPath is a base path of the current one. This means that the current PersistentPropertyPath 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

      PersistentPropertyPath<P> getExtensionForBaseOf(PersistentPropertyPath<P> base)
      Returns the sub-path of the current one as if it was based on the given base path. So for a current path foo.bar and a given base foo it would return bar. If the given path is not a base of the the current one the current PersistentPropertyPath will be returned as is.
      Parameters:
      base - must not be null.
      Returns:
      will never be null.
    • getParentPath

      @Nullable PersistentPropertyPath<P> getParentPath() throws IllegalStateException
      Returns the parent path of the current PersistentPropertyPath, 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 the PersistentPropertyPath.
      Returns:
      a value greater than 0.