diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/support/StandardEvaluationContext.java b/spring-expression/src/main/java/org/springframework/expression/spel/support/StandardEvaluationContext.java index cff7eb45aba..3886366b762 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/support/StandardEvaluationContext.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/support/StandardEvaluationContext.java @@ -244,14 +244,39 @@ public class StandardEvaluationContext implements EvaluationContext { } } + /** + * Set multiple named variables in this evaluation context to given values. + *
This is a convenience variant of {@link #setVariable(String, Object)}.
+ * @param variables the names and values of the variables to set
+ * @see #setVariable(String, Object)
+ */
public void setVariables(Map Note: Function names share a namespace with the variables in this
+ * evaluation context, as populated by {@link #setVariable(String, Object)}.
+ * Make sure that specified function names and variable names do not overlap.
+ * @param name the name of the function
+ * @param method the Method to register
+ * @see #registerFunction(String, MethodHandle)
+ */
public void registerFunction(String name, Method method) {
this.variables.put(name, method);
}
+ /**
+ * Register the specified MethodHandle as a SpEL function.
+ * Note: Function names share a namespace with the variables in this
+ * evaluation context, as populated by {@link #setVariable(String, Object)}.
+ * Make sure that specified function names and variable names do not overlap.
+ * @param name the name of the function
+ * @param methodHandle the MethodHandle to register
+ * @since 6.1
+ * @see #registerFunction(String, Method)
+ */
public void registerFunction(String name, MethodHandle methodHandle) {
this.variables.put(name, methodHandle);
}