Interface PropertyPath
- All Superinterfaces:
Iterable<PropertyPath>, Streamable<PropertyPath>, Supplier<Stream<PropertyPath>>
Abstraction of a
PropertyPath within a domain class.- Author:
- Oliver Gierke, Christoph Strobl, Mark Paluch, Mariusz MÄ…czkowski, Johannes Englmeier
-
Method Summary
Modifier and TypeMethodDescriptionstatic PropertyPathstatic PropertyPathfrom(String source, TypeInformation<?> type) default PropertyPathReturns the leaf property of thePropertyPath.default Class<?> Returns the type of the leaf property of the currentPropertyPath.Returns the owning type of thePropertyPath.Returns the first part of thePropertyPath.default Class<?> getType()Returns the actual type of the property.Returns the type information of the property.default booleanhasNext()Returns whether there is a nestedPropertyPath.default booleanReturns whether thePropertyPathis actually a collection.iterator()Returns anIterator of PropertyPaththat iterates over all the partial property paths with the same leaf type but decreasing length.default PropertyPathReturns thePropertyPathfor the path nested under the current property.next()Returns thePropertyPathpath that results from removing the first element of the current one.default StringReturns thePropertyPathin dot notation.Methods inherited from interface Iterable
forEach, spliterator
-
Method Details
-
getOwningType
TypeInformation<?> getOwningType()Returns the owning type of thePropertyPath.- Returns:
- the owningType will never be null.
-
getSegment
String getSegment()Returns the first part of thePropertyPath. For example:PropertyPath.from("a.b.c", Some.class).getSegment();results ina.- Returns:
- the name will never be null.
-
getLeafProperty
Returns the leaf property of thePropertyPath.- Returns:
- will never be null.
-
getLeafType
Returns the type of the leaf property of the currentPropertyPath.- Returns:
- will never be null.
-
getType
-
getTypeInformation
TypeInformation<?> getTypeInformation()Returns the type information of the property.- Returns:
- the actual type of the property.
-
next
@Nullable PropertyPath next()Returns 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:
-
hasNext
default boolean hasNext()Returns whether there is a nestedPropertyPath. If this returns true you can expectnext()to return a non- null value.- Returns:
-
toDotPath
Returns thePropertyPathin dot notation.- Returns:
- the
PropertyPathin dot notation.
-
isCollection
default boolean isCollection()Returns whether thePropertyPathis actually a collection.- Returns:
- true whether the
PropertyPathis actually a collection.
-
nested
Returns thePropertyPathfor the path nested under the current property.- Parameters:
path- must not be null or empty.- Returns:
- will never be null.
-
iterator
Iterator<PropertyPath> iterator()Returns anIterator of PropertyPaththat 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 interfaceIterable<PropertyPath>
-
from
Extracts thePropertyPathchain from the given sourceStringandTypeInformation.
Uses(?:[%s]?([%s]*?[^%s]+))by default and(?:[%s]?([%s]*?[^%s]+))forquotedliterals.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 foruserAddressCitythe interpretationuserAddress.cityis preferred overuser.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.
-
from
Extracts thePropertyPathchain from the given sourceStringandTypeInformation.
Uses(?:[%s]?([%s]*?[^%s]+))by default and(?:[%s]?([%s]*?[^%s]+))forquotedliterals.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 foruserAddressCitythe interpretationuserAddress.cityis preferred overuser.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.
-