Skip to content

Commit 876e417

Browse files
committed
Javadoc for setVariables and registerFunction
See gh-30045
1 parent e6c812e commit 876e417

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

spring-expression/src/main/java/org/springframework/expression/spel/support/StandardEvaluationContext.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,39 @@ public void setVariable(@Nullable String name, @Nullable Object value) {
244244
}
245245
}
246246

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+
*/
247253
public void setVariables(Map<String, Object> variables) {
248254
variables.forEach(this::setVariable);
249255
}
250256

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+
*/
251266
public void registerFunction(String name, Method method) {
252267
this.variables.put(name, method);
253268
}
254269

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+
*/
255280
public void registerFunction(String name, MethodHandle methodHandle) {
256281
this.variables.put(name, methodHandle);
257282
}

0 commit comments

Comments
 (0)