Skip to content

Commit fd4e450

Browse files
committed
Polishing.
See #3377
1 parent efd9e94 commit fd4e450

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

src/main/java/org/springframework/data/mapping/PropertyPath.java

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ default PropertyPath getLeafProperty() {
6464

6565
PropertyPath result = this;
6666

67-
while (result.hasNext()) {
67+
while (result != null && result.hasNext()) {
6868
result = result.next();
6969
}
7070

71-
return result;
71+
return result == null ? this : result;
7272
}
7373

7474
/**
@@ -158,8 +158,8 @@ default PropertyPath nested(String path) {
158158
}
159159

160160
/**
161-
* Returns an {@link Iterator <PropertyPath>} that iterates over all the partial property paths with the same leaf
162-
* type but decreasing length. For example:
161+
* Returns an {@link Iterator Iterator of PropertyPath} that iterates over all the partial property paths with the
162+
* same leaf type but decreasing length. For example:
163163
*
164164
* <pre class="code">
165165
* PropertyPath propertyPath = PropertyPath.from("a.b.c", Some.class);
@@ -179,13 +179,12 @@ default PropertyPath nested(String path) {
179179

180180
/**
181181
* Extracts the {@link PropertyPath} chain from the given source {@link String} and {@link TypeInformation}. <br />
182-
* Uses {@link SimplePropertyPath#SPLITTER} by default and {@link SimplePropertyPath#SPLITTER_FOR_QUOTED} for
182+
* Uses {@code (?:[%s]?([%s]*?[^%s]+))} by default and {@code (?:[%s]?([%s]*?[^%s]+))} for
183183
* {@link Pattern#quote(String) quoted} literals.
184184
* <p>
185185
* Separate parts of the path may be separated by {@code "."} or by {@code "_"} or by camel case. When the match to
186-
* properties is ambiguous longer property names are preferred. So for "userAddressCity" the interpretation
187-
* "userAddress.city" is preferred over "user.address.city".
188-
* </p>
186+
* properties is ambiguous longer property names are preferred. So for {@code userAddressCity} the interpretation
187+
* {@code userAddress.city} is preferred over {@code user.address.city}.
189188
*
190189
* @param source a String denoting the property path, must not be {@literal null}.
191190
* @param type the owning type of the property path, must not be {@literal null}.
@@ -197,13 +196,12 @@ static PropertyPath from(String source, Class<?> type) {
197196

198197
/**
199198
* Extracts the {@link PropertyPath} chain from the given source {@link String} and {@link TypeInformation}. <br />
200-
* Uses {@link SimplePropertyPath#SPLITTER} by default and {@link SimplePropertyPath#SPLITTER_FOR_QUOTED} for
199+
* Uses {@code (?:[%s]?([%s]*?[^%s]+))} by default and {@code (?:[%s]?([%s]*?[^%s]+))} for
201200
* {@link Pattern#quote(String) quoted} literals.
202201
* <p>
203202
* Separate parts of the path may be separated by {@code "."} or by {@code "_"} or by camel case. When the match to
204-
* properties is ambiguous longer property names are preferred. So for "userAddressCity" the interpretation
205-
* "userAddress.city" is preferred over "user.address.city".
206-
* </p>
203+
* properties is ambiguous longer property names are preferred. So for {@code userAddressCity} the interpretation
204+
* {@code userAddress.city} is preferred over {@code user.address.city}.
207205
*
208206
* @param source a String denoting the property path, must not be {@literal null}.
209207
* @param type the owning type of the property path, must not be {@literal null}.

0 commit comments

Comments
 (0)