@@ -244,14 +244,39 @@ public void setVariable(@Nullable String name, @Nullable Object value) {
244
244
}
245
245
}
246
246
247
+ /**
248
+ * Set multiple named variables in this evaluation context to given values.
249
+ * <p>This is a convenience variant of {@link #setVariable(String, Object)}.
250
+ * @param variables the names and values of the variables to set
251
+ * @see #setVariable(String, Object)
252
+ */
247
253
public void setVariables (Map <String , Object > variables ) {
248
254
variables .forEach (this ::setVariable );
249
255
}
250
256
257
+ /**
258
+ * Register the specified Method as a SpEL function.
259
+ * <p>Note: Function names share a namespace with the variables in this
260
+ * evaluation context, as populated by {@link #setVariable(String, Object)}.
261
+ * Make sure that specified function names and variable names do not overlap.
262
+ * @param name the name of the function
263
+ * @param method the Method to register
264
+ * @see #registerFunction(String, MethodHandle)
265
+ */
251
266
public void registerFunction (String name , Method method ) {
252
267
this .variables .put (name , method );
253
268
}
254
269
270
+ /**
271
+ * Register the specified MethodHandle as a SpEL function.
272
+ * <p>Note: Function names share a namespace with the variables in this
273
+ * evaluation context, as populated by {@link #setVariable(String, Object)}.
274
+ * Make sure that specified function names and variable names do not overlap.
275
+ * @param name the name of the function
276
+ * @param methodHandle the MethodHandle to register
277
+ * @since 6.1
278
+ * @see #registerFunction(String, Method)
279
+ */
255
280
public void registerFunction (String name , MethodHandle methodHandle ) {
256
281
this .variables .put (name , methodHandle );
257
282
}
0 commit comments