Package org.springframework.data.mapping
Class PropertyPath
java.lang.Object
org.springframework.data.mapping.PropertyPath
- All Implemented Interfaces:
- Iterable<PropertyPath>,- Supplier<Stream<PropertyPath>>,- Streamable<PropertyPath>
Abstraction of a 
PropertyPath of a domain class.- Author:
- Oliver Gierke, Christoph Strobl, Mark Paluch, Mariusz MÄ…czkowski, Johannes Englmeier
- 
Method SummaryModifier and TypeMethodDescriptionbooleanstatic PropertyPathstatic PropertyPathfrom(String source, TypeInformation<?> type) Returns the leaf property of thePropertyPath.Class<?>Returns the type of the leaf property of the currentPropertyPath.Returns the owning type of thePropertyPath.Returns the first part of thePropertyPath.Class<?>getType()Returns the actual type of the property.inthashCode()booleanhasNext()Returns whether there is a nestedPropertyPath.booleanReturns whether thePropertyPathis actually a collection.iterator()Returns anIterator<PropertyPath>that iterates over all the partial property paths with the same leaf type but decreasing length.Returns thePropertyPathfor the path nested under the current property.next()Returns thePropertyPathpath that results from removing the first element of the current one.Returns thePropertyPathin dot notation.toString()Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.IterableforEach, spliterator
- 
Method Details- 
getOwningTypeReturns the owning type of thePropertyPath.- Returns:
- the owningType will never be null.
 
- 
getSegmentReturns the first part of thePropertyPath. For example:PropertyPath.from("a.b.c", Some.class).getSegment();results ina.- Returns:
- the name will never be null.
 
- 
getLeafPropertyReturns the leaf property of thePropertyPath.- Returns:
- will never be null.
 
- 
getLeafTypeReturns the type of the leaf property of the currentPropertyPath.- Returns:
- will never be null.
 
- 
getTypeReturns the actual type of the property. Will return the plain resolved type for simple properties, the component type for anyIterableor the value type of aMap.- Returns:
- the actual type of the property.
 
- 
getTypeInformation
- 
nextReturns thePropertyPathpath that results from removing the first element of the current one. For example:PropertyPath.from("a.b.c", Some.class).next().toDotPath();results in the output:b.c- Returns:
- the next nested PropertyPathor null if no nestedPropertyPathavailable.
- See Also:
 
- 
hasNextpublic boolean hasNext()Returns whether there is a nestedPropertyPath. If this returns true you can expectnext()to return a non- null value.- Returns:
 
- 
toDotPathReturns thePropertyPathin dot notation.- Returns:
- the PropertyPathin dot notation.
 
- 
isCollectionpublic boolean isCollection()Returns whether thePropertyPathis actually a collection.- Returns:
- true whether the PropertyPathis actually a collection.
 
- 
nestedReturns thePropertyPathfor the path nested under the current property.- Parameters:
- path- must not be null or empty.
- Returns:
- will never be null.
 
- 
iteratorReturns anIterator<PropertyPath>that iterates over all the partial property paths with the same leaf type but decreasing length. For example:PropertyPath propertyPath = PropertyPath.from("a.b.c", Some.class); propertyPath.forEach(p -> p.toDotPath());results in the dot paths: *a.b.c b.c c - Specified by:
- iteratorin interface- Iterable<PropertyPath>
 
- 
equals
- 
hashCodepublic int hashCode()
- 
fromExtracts thePropertyPathchain from the given sourceStringandTypeInformation.
 UsesSPLITTERby default andSPLITTER_FOR_QUOTEDforquotedliterals.Separate parts of the path may be separated by "."or by"_"or by camel case. When the match to properties is ambiguous longer property names are preferred. So for "userAddressCity" the interpretation "userAddress.city" is preferred over "user.address.city".- Parameters:
- source- a String denoting the property path, must not be null.
- type- the owning type of the property path, must not be null.
- Returns:
- a new PropertyPathguaranteed to be not null.
 
- 
fromExtracts thePropertyPathchain from the given sourceStringandTypeInformation.
 UsesSPLITTERby default andSPLITTER_FOR_QUOTEDforquotedliterals.Separate parts of the path may be separated by "."or by"_"or by camel case. When the match to properties is ambiguous longer property names are preferred. So for "userAddressCity" the interpretation "userAddress.city" is preferred over "user.address.city".- Parameters:
- source- a String denoting the property path, must not be null.
- type- the owning type of the property path, must not be null.
- Returns:
- a new PropertyPathguaranteed to be not null.
 
- 
toString
 
-