@@ -108,15 +108,13 @@ public TypeInformation<?> getOwningType() {
108108 }
109109
110110 /**
111- * Returns the first part of the {@link PropertyPath}.
111+ * Returns the first part of the {@link PropertyPath}. For example:
112112 *
113- * <pre>
114- * {@code
113+ * <pre class="code">
115114 * PropertyPath.from("a.b.c", Some.class).getSegment();
116- * }
117115 * </pre>
118116 *
119- * will result in {@code "a"}
117+ * results in {@code a}.
120118 *
121119 * @return the name will never be {@literal null}.
122120 */
@@ -150,10 +148,10 @@ public Class<?> getLeafType() {
150148 }
151149
152150 /**
153- * Returns the type of the property will return the plain resolved type for simple properties, the component type for
154- * any {@link Iterable} or the value type of a {@link java.util.Map} if the property is one .
151+ * Returns the actual type of the property. Will return the plain resolved type for simple properties, the component
152+ * type for any {@link Iterable} or the value type of a {@link java.util.Map}.
155153 *
156- * @return
154+ * @return the actual type of the property.
157155 */
158156 public Class <?> getType () {
159157 return this .actualTypeInformation .getType ();
@@ -164,15 +162,13 @@ public TypeInformation<?> getTypeInformation() {
164162 }
165163
166164 /**
167- * Returns the {@link PropertyPath} path that results from removing the first element of the current one.
165+ * Returns the {@link PropertyPath} path that results from removing the first element of the current one. For example:
168166 *
169- * <pre>
170- * {@code
171- * System.out.println(PropertyPath.from("a.b.c", Some.class).next().toDotPath());
172- * }
167+ * <pre class="code">
168+ * PropertyPath.from("a.b.c", Some.class).next().toDotPath();
173169 * </pre>
174170 *
175- * Will result in the output: {@code b.c}
171+ * results in the output: {@code b.c}
176172 *
177173 * @return the next nested {@link PropertyPath} or {@literal null} if no nested {@link PropertyPath} available.
178174 * @see #hasNext()
@@ -195,7 +191,7 @@ public boolean hasNext() {
195191 /**
196192 * Returns the {@link PropertyPath} in dot notation.
197193 *
198- * @return
194+ * @return the {@link PropertyPath} in dot notation.
199195 */
200196 public String toDotPath () {
201197
@@ -209,7 +205,7 @@ public String toDotPath() {
209205 /**
210206 * Returns whether the {@link PropertyPath} is actually a collection.
211207 *
212- * @return
208+ * @return {@literal true} whether the {@link PropertyPath} is actually a collection.
213209 */
214210 public boolean isCollection () {
215211 return isCollection ;
@@ -232,37 +228,34 @@ public PropertyPath nested(String path) {
232228
233229 /**
234230 * Returns an {@link Iterator<PropertyPath>} that iterates over all the partial property paths with the same leaf type
235- * but decreasing length.
231+ * but decreasing length. For example:
236232 *
237- * <pre>
238- * {@code
233+ * <pre class="code">
239234 * PropertyPath propertyPath = PropertyPath.from("a.b.c", Some.class);
240- * for (p : propertyPath.iterator()) {
241- * System.out.println(p.toDotPath());
242- * };
243- * }
235+ * propertyPath.forEach(p -> p.toDotPath());
244236 * </pre>
245237 *
246- * Results in the output:
238+ * results in the dot paths: *
247239 *
248- * <pre>
249- * {@code
240+ * <pre class="code">
250241 * a.b.c
251242 * b.c
252243 * c
253- * }
254244 * </pre>
255245 */
246+ @ Override
256247 public Iterator <PropertyPath > iterator () {
257248
258249 return new Iterator <PropertyPath >() {
259250
260251 private @ Nullable PropertyPath current = PropertyPath .this ;
261252
253+ @ Override
262254 public boolean hasNext () {
263255 return current != null ;
264256 }
265257
258+ @ Override
266259 @ Nullable
267260 public PropertyPath next () {
268261
@@ -275,10 +268,6 @@ public PropertyPath next() {
275268 this .current = result .next ();
276269 return result ;
277270 }
278-
279- public void remove () {
280- throw new UnsupportedOperationException ();
281- }
282271 };
283272 }
284273
@@ -297,11 +286,9 @@ public boolean equals(@Nullable Object o) {
297286 return false ;
298287 }
299288
300- return Objects .equals (this .owningType , that .owningType )
301- && Objects .equals (this .name , that .name )
289+ return Objects .equals (this .owningType , that .owningType ) && Objects .equals (this .name , that .name )
302290 && Objects .equals (this .typeInformation , that .typeInformation )
303- && Objects .equals (this .actualTypeInformation , that .actualTypeInformation )
304- && Objects .equals (next , that .next );
291+ && Objects .equals (this .actualTypeInformation , that .actualTypeInformation ) && Objects .equals (next , that .next );
305292 }
306293
307294 @ Override
@@ -312,7 +299,7 @@ public int hashCode() {
312299 /**
313300 * Returns the next {@link PropertyPath}.
314301 *
315- * @return
302+ * @return the next {@link PropertyPath}.
316303 * @throws IllegalStateException it there's no next one.
317304 */
318305 private PropertyPath requiredNext () {
@@ -337,8 +324,8 @@ private PropertyPath requiredNext() {
337324 * "userAddress.city" is preferred over "user.address.city".
338325 * </p>
339326 *
340- * @param source a String denoting the property path. Must not be {@literal null}.
341- * @param type the owning type of the property path. Must not be {@literal null}.
327+ * @param source a String denoting the property path, must not be {@literal null}.
328+ * @param type the owning type of the property path, must not be {@literal null}.
342329 * @return a new {@link PropertyPath} guaranteed to be not {@literal null}.
343330 */
344331 public static PropertyPath from (String source , Class <?> type ) {
@@ -355,8 +342,8 @@ public static PropertyPath from(String source, Class<?> type) {
355342 * "userAddress.city" is preferred over "user.address.city".
356343 * </p>
357344 *
358- * @param source a String denoting the property path. Must not be {@literal null}.
359- * @param type the owning type of the property path. Must not be {@literal null}.
345+ * @param source a String denoting the property path, must not be {@literal null}.
346+ * @param type the owning type of the property path, must not be {@literal null}.
360347 * @return a new {@link PropertyPath} guaranteed to be not {@literal null}.
361348 */
362349 public static PropertyPath from (String source , TypeInformation <?> type ) {
0 commit comments