@@ -108,15 +108,13 @@ public TypeInformation<?> getOwningType() {
108
108
}
109
109
110
110
/**
111
- * Returns the first part of the {@link PropertyPath}.
111
+ * Returns the first part of the {@link PropertyPath}. For example:
112
112
*
113
- * <pre>
114
- * {@code
113
+ * <pre class="code">
115
114
* PropertyPath.from("a.b.c", Some.class).getSegment();
116
- * }
117
115
* </pre>
118
116
*
119
- * will result in {@code "a"}
117
+ * results in {@code a}.
120
118
*
121
119
* @return the name will never be {@literal null}.
122
120
*/
@@ -150,10 +148,10 @@ public Class<?> getLeafType() {
150
148
}
151
149
152
150
/**
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}.
155
153
*
156
- * @return
154
+ * @return the actual type of the property.
157
155
*/
158
156
public Class <?> getType () {
159
157
return this .actualTypeInformation .getType ();
@@ -164,15 +162,13 @@ public TypeInformation<?> getTypeInformation() {
164
162
}
165
163
166
164
/**
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:
168
166
*
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();
173
169
* </pre>
174
170
*
175
- * Will result in the output: {@code b.c}
171
+ * results in the output: {@code b.c}
176
172
*
177
173
* @return the next nested {@link PropertyPath} or {@literal null} if no nested {@link PropertyPath} available.
178
174
* @see #hasNext()
@@ -195,7 +191,7 @@ public boolean hasNext() {
195
191
/**
196
192
* Returns the {@link PropertyPath} in dot notation.
197
193
*
198
- * @return
194
+ * @return the {@link PropertyPath} in dot notation.
199
195
*/
200
196
public String toDotPath () {
201
197
@@ -209,7 +205,7 @@ public String toDotPath() {
209
205
/**
210
206
* Returns whether the {@link PropertyPath} is actually a collection.
211
207
*
212
- * @return
208
+ * @return {@literal true} whether the {@link PropertyPath} is actually a collection.
213
209
*/
214
210
public boolean isCollection () {
215
211
return isCollection ;
@@ -232,37 +228,34 @@ public PropertyPath nested(String path) {
232
228
233
229
/**
234
230
* 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:
236
232
*
237
- * <pre>
238
- * {@code
233
+ * <pre class="code">
239
234
* 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());
244
236
* </pre>
245
237
*
246
- * Results in the output:
238
+ * results in the dot paths: *
247
239
*
248
- * <pre>
249
- * {@code
240
+ * <pre class="code">
250
241
* a.b.c
251
242
* b.c
252
243
* c
253
- * }
254
244
* </pre>
255
245
*/
246
+ @ Override
256
247
public Iterator <PropertyPath > iterator () {
257
248
258
249
return new Iterator <PropertyPath >() {
259
250
260
251
private @ Nullable PropertyPath current = PropertyPath .this ;
261
252
253
+ @ Override
262
254
public boolean hasNext () {
263
255
return current != null ;
264
256
}
265
257
258
+ @ Override
266
259
@ Nullable
267
260
public PropertyPath next () {
268
261
@@ -275,10 +268,6 @@ public PropertyPath next() {
275
268
this .current = result .next ();
276
269
return result ;
277
270
}
278
-
279
- public void remove () {
280
- throw new UnsupportedOperationException ();
281
- }
282
271
};
283
272
}
284
273
@@ -297,11 +286,9 @@ public boolean equals(@Nullable Object o) {
297
286
return false ;
298
287
}
299
288
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 )
302
290
&& 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 );
305
292
}
306
293
307
294
@ Override
@@ -312,7 +299,7 @@ public int hashCode() {
312
299
/**
313
300
* Returns the next {@link PropertyPath}.
314
301
*
315
- * @return
302
+ * @return the next {@link PropertyPath}.
316
303
* @throws IllegalStateException it there's no next one.
317
304
*/
318
305
private PropertyPath requiredNext () {
@@ -337,8 +324,8 @@ private PropertyPath requiredNext() {
337
324
* "userAddress.city" is preferred over "user.address.city".
338
325
* </p>
339
326
*
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}.
342
329
* @return a new {@link PropertyPath} guaranteed to be not {@literal null}.
343
330
*/
344
331
public static PropertyPath from (String source , Class <?> type ) {
@@ -355,8 +342,8 @@ public static PropertyPath from(String source, Class<?> type) {
355
342
* "userAddress.city" is preferred over "user.address.city".
356
343
* </p>
357
344
*
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}.
360
347
* @return a new {@link PropertyPath} guaranteed to be not {@literal null}.
361
348
*/
362
349
public static PropertyPath from (String source , TypeInformation <?> type ) {
0 commit comments