@@ -59,6 +59,7 @@ static <T, P> TypedPropertyPath<T, P> of(TypedPropertyPath<T, P> propertyPath) {
5959 * @return the typed property path.
6060 * @since 4.1
6161 */
62+ @ SuppressWarnings ({ "unchecked" , "rawtypes" })
6263 static <T , P > TypedPropertyPath <T , P > ofMany (TypedPropertyPath <T , ? extends Iterable <P >> propertyPath ) {
6364 return (TypedPropertyPath ) TypedPropertyPaths .of (propertyPath );
6465 }
@@ -71,22 +72,25 @@ static <T, P> TypedPropertyPath<T, P> ofMany(TypedPropertyPath<T, ? extends Iter
7172 TypeInformation <?> getOwningType ();
7273
7374 /**
74- * Returns the first part of the {@link PropertyPath}. For example:
75+ * Returns the current property path segment (i.e. first part of {@link #toDotPath()}).
76+ * <p>
77+ * For example:
7578 *
7679 * <pre class="code">
7780 * PropertyPath.from("a.b.c", Some.class).getSegment();
7881 * </pre>
7982 *
8083 * results in {@code a}.
8184 *
82- * @return the name will never be {@literal null} .
85+ * @return the current property path segment .
8386 */
8487 String getSegment ();
8588
8689 /**
87- * Returns the leaf property of the {@link PropertyPath}.
90+ * Returns the leaf property of the {@link PropertyPath}. Either this property if the path ends here or the last
91+ * property in the chain.
8892 *
89- * @return will never be {@literal null} .
93+ * @return leaf property .
9094 */
9195 default PropertyPath getLeafProperty () {
9296
@@ -103,57 +107,72 @@ default PropertyPath getLeafProperty() {
103107 * Returns the type of the leaf property of the current {@link PropertyPath}.
104108 *
105109 * @return will never be {@literal null}.
110+ * @see #getLeafProperty()
106111 */
107112 default Class <?> getLeafType () {
108113 return getLeafProperty ().getType ();
109114 }
110115
111116 /**
112- * Returns the actual type of the property. Will return the plain resolved type for simple properties, the component
113- * type for any {@link Iterable} or the value type of a {@link java.util.Map}.
117+ * Returns the actual type of the property at this segment . Will return the plain resolved type for simple properties,
118+ * the component type for any {@link Iterable} or the value type of {@link java.util.Map} properties .
114119 *
115120 * @return the actual type of the property.
121+ * @see #getTypeInformation()
122+ * @see TypeInformation#getRequiredActualType()
116123 */
117124 default Class <?> getType () {
118125 return getTypeInformation ().getRequiredActualType ().getType ();
119126 }
120127
121128 /**
122- * Returns the type information of the property.
129+ * Returns the type information for the property at this segment .
123130 *
124- * @return the actual type of the property.
131+ * @return the type information for the property at this segment .
125132 */
126133 TypeInformation <?> getTypeInformation ();
127134
128135 /**
129- * Returns the {@link PropertyPath} path that results from removing the first element of the current one. For example:
136+ * Returns whether the current property path segment is a collection.
137+ *
138+ * @return {@literal true} if the current property path segment is a collection.
139+ * @see #getTypeInformation()
140+ * @see TypeInformation#isCollectionLike()
141+ */
142+ default boolean isCollection () {
143+ return getTypeInformation ().isCollectionLike ();
144+ }
145+
146+ /**
147+ * Returns the next {@code PropertyPath} segment in the property path chain.
130148 *
131149 * <pre class="code">
132150 * PropertyPath.from("a.b.c", Some.class).next().toDotPath();
133151 * </pre>
134152 *
135153 * results in the output: {@code b.c}
136154 *
137- * @return the next nested {@link PropertyPath} or {@literal null} if no nested {@link PropertyPath} available .
155+ * @return the next {@code PropertyPath} or {@literal null} if the path does not contain further segments .
138156 * @see #hasNext()
139157 */
140158 @ Nullable
141159 PropertyPath next ();
142160
143161 /**
144- * Returns whether there is a nested {@link PropertyPath}. If this returns {@literal true} you can expect
145- * {@link #next()} to return a non- {@literal null} value .
162+ * Returns {@literal true} if the property path contains further segments or {@literal false} if the path ends at this
163+ * segment .
146164 *
147- * @return
165+ * @return {@literal true} if the property path contains further segments or {@literal false} if the path ends at this
166+ * segment.
148167 */
149168 default boolean hasNext () {
150169 return next () != null ;
151170 }
152171
153172 /**
154- * Returns the {@link PropertyPath} in dot notation.
173+ * Returns the {@code PropertyPath} in dot notation.
155174 *
156- * @return the {@link PropertyPath} in dot notation.
175+ * @return the {@code PropertyPath} in dot notation.
157176 */
158177 default String toDotPath () {
159178
@@ -162,16 +181,7 @@ default String toDotPath() {
162181 }
163182
164183 /**
165- * Returns whether the {@link PropertyPath} is actually a collection.
166- *
167- * @return {@literal true} whether the {@link PropertyPath} is actually a collection.
168- */
169- default boolean isCollection () {
170- return getTypeInformation ().isCollectionLike ();
171- }
172-
173- /**
174- * Returns the {@link PropertyPath} for the path nested under the current property.
184+ * Returns the {@code PropertyPath} for the path nested under the current property.
175185 *
176186 * @param path must not be {@literal null} or empty.
177187 * @return will never be {@literal null}.
@@ -186,8 +196,7 @@ default PropertyPath nested(String path) {
186196 }
187197
188198 /**
189- * Returns an {@link Iterator Iterator of PropertyPath} that iterates over all the partial property paths with the
190- * same leaf type but decreasing length. For example:
199+ * Returns an {@link Iterator Iterator of PropertyPath} that iterates over all property path segments. For example:
191200 *
192201 * <pre class="code">
193202 * PropertyPath propertyPath = PropertyPath.from("a.b.c", Some.class);
@@ -197,9 +206,9 @@ default PropertyPath nested(String path) {
197206 * results in the dot paths:
198207 *
199208 * <pre class="code">
200- * a.b.c
201- * b.c
202- * c
209+ * a.b.c (this object)
210+ * b.c (next() object)
211+ * c (next().next() object)
203212 * </pre>
204213 */
205214 @ Override
0 commit comments