File tree 1 file changed +25
-2
lines changed
src/main/java/org/springframework/data/repository/query
1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -303,12 +303,35 @@ public boolean isQuoted(int index) {
303
303
return quotations .isQuoted (index );
304
304
}
305
305
306
+ /**
307
+ * @param name
308
+ * @return
309
+ * @since 4.0
310
+ */
311
+ public boolean hasExpression (String name ) {
312
+ return expressions .get (name ) != null ;
313
+ }
314
+
315
+ @ Nullable
306
316
public ValueExpression getParameter (String name ) {
317
+ return expressions .get (name );
318
+ }
319
+
320
+ /**
321
+ * Returns the required {@link ValueExpression} for the given name or throws an {@link IllegalArgumentException} if
322
+ * the parameter is not present.
323
+ *
324
+ * @param name
325
+ * @return
326
+ * @throws IllegalArgumentException if the parameter is not present.
327
+ * @since 4.0
328
+ */
329
+ public ValueExpression getRequiredParameter (String name ) {
307
330
308
- ValueExpression valueExpression = expressions . get (name );
331
+ ValueExpression valueExpression = getParameter (name );
309
332
310
333
if (valueExpression == null ) {
311
- throw new IllegalArgumentException ("No ValueExpression with name '%s' found in query. " .formatted (name ));
334
+ throw new IllegalArgumentException ("No ValueExpression with name '%s' found in query" .formatted (name ));
312
335
}
313
336
314
337
return valueExpression ;
You can’t perform that action at this time.
0 commit comments