From 876e417eb487d12de352cc0c07a4082042f77b91 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 23 May 2023 20:01:02 +0200 Subject: [PATCH] Javadoc for setVariables and registerFunction See gh-30045 --- .../support/StandardEvaluationContext.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) 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 variables) { variables.forEach(this::setVariable); } + /** + * Register the specified Method 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 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); }