18
18
19
19
import java .lang .reflect .Method ;
20
20
import java .util .ArrayList ;
21
- import java .util .HashMap ;
22
21
import java .util .List ;
23
22
import java .util .Map ;
23
+ import java .util .concurrent .ConcurrentHashMap ;
24
24
25
25
import org .springframework .core .convert .TypeDescriptor ;
26
26
import org .springframework .expression .BeanResolver ;
@@ -88,7 +88,7 @@ public class StandardEvaluationContext implements EvaluationContext {
88
88
89
89
private OperatorOverloader operatorOverloader = new StandardOperatorOverloader ();
90
90
91
- private final Map <String , Object > variables = new HashMap <>();
91
+ private final Map <String , Object > variables = new ConcurrentHashMap <>();
92
92
93
93
94
94
/**
@@ -203,7 +203,7 @@ public void setTypeConverter(TypeConverter typeConverter) {
203
203
@ Override
204
204
public TypeConverter getTypeConverter () {
205
205
if (this .typeConverter == null ) {
206
- this .typeConverter = new StandardTypeConverter ();
206
+ this .typeConverter = new StandardTypeConverter ();
207
207
}
208
208
return this .typeConverter ;
209
209
}
@@ -230,11 +230,16 @@ public OperatorOverloader getOperatorOverloader() {
230
230
231
231
@ Override
232
232
public void setVariable (String name , @ Nullable Object value ) {
233
- this .variables .put (name , value );
233
+ if (value != null ) {
234
+ this .variables .put (name , value );
235
+ }
236
+ else {
237
+ this .variables .remove (name );
238
+ }
234
239
}
235
240
236
- public void setVariables (Map <String ,Object > variables ) {
237
- this . variables .putAll ( variables );
241
+ public void setVariables (Map <String , Object > variables ) {
242
+ variables .forEach ( this :: setVariable );
238
243
}
239
244
240
245
public void registerFunction (String name , Method method ) {
0 commit comments