Class PropertyPath

java.lang.Object
org.springframework.data.mapping.PropertyPath
All Implemented Interfaces:
Iterable<PropertyPath>, Supplier<Stream<PropertyPath>>, Streamable<PropertyPath>

public class PropertyPath extends Object implements Streamable<PropertyPath>
Abstraction of a PropertyPath of a domain class.
Author:
Oliver Gierke, Christoph Strobl, Mark Paluch, Mariusz MÄ…czkowski, Johannes Englmeier
  • Method Details

    • getOwningType

      public TypeInformation<?> getOwningType()
      Returns the owning type of the PropertyPath.
      Returns:
      the owningType will never be null.
    • getSegment

      public String getSegment()
      Returns the name of the PropertyPath.
      Returns:
      the name will never be null.
    • getLeafProperty

      public PropertyPath getLeafProperty()
      Returns the leaf property of the PropertyPath.
      Returns:
      will never be null.
    • getLeafType

      public Class<?> getLeafType()
      Returns the type of the leaf property of the current PropertyPath.
      Returns:
      will never be null.
    • getType

      public Class<?> getType()
      Returns the type of the property will return the plain resolved type for simple properties, the component type for any Iterable or the value type of a Map if the property is one.
      Returns:
    • getTypeInformation

      public TypeInformation<?> getTypeInformation()
    • next

      @Nullable public PropertyPath next()
      Returns the next nested PropertyPath.
      Returns:
      the next nested PropertyPath or null if no nested PropertyPath available.
      See Also:
    • hasNext

      public boolean hasNext()
      Returns whether there is a nested PropertyPath. If this returns true you can expect next() to return a non- null value.
      Returns:
    • toDotPath

      public String toDotPath()
      Returns the PropertyPath in dot notation.
      Returns:
    • isCollection

      public boolean isCollection()
      Returns whether the PropertyPath is actually a collection.
      Returns:
    • nested

      public PropertyPath nested(String path)
      Returns the PropertyPath for the path nested under the current property.
      Parameters:
      path - must not be null or empty.
      Returns:
      will never be null.
    • iterator

      public Iterator<PropertyPath> iterator()
      Specified by:
      iterator in interface Iterable<PropertyPath>
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • from

      public static PropertyPath from(String source, Class<?> type)
      Extracts the PropertyPath chain from the given source String and type.
      Parameters:
      source -
      type -
      Returns:
    • from

      public static PropertyPath from(String source, TypeInformation<?> type)
      Extracts the PropertyPath chain from the given source String and TypeInformation.
      Uses SPLITTER by default and SPLITTER_FOR_QUOTED for quoted literals.
      Parameters:
      source - must not be null.
      type -
      Returns:
    • toString

      public String toString()
      Overrides:
      toString in class Object