01: package org.mvel;
02:
03: import org.mvel.integration.VariableResolverFactory;
04: import static org.mvel.optimizers.OptimizerFactory.getAccessorCompiler;
05:
06: import java.io.Serializable;
07:
08: public class CompiledSetExpression implements Serializable {
09: private char[] expression;
10: private SetAccessor accessor;
11:
12: public CompiledSetExpression(char[] expression) {
13: this .expression = expression;
14: }
15:
16: public void setValue(Object ctx, VariableResolverFactory vrf,
17: Object value) {
18: if (accessor == null) {
19: accessor = getAccessorCompiler("reflective")
20: .optimizeSetAccessor(expression, ctx, ctx, vrf,
21: false, value);
22: } else {
23: accessor.setValue(ctx, vrf, value);
24: }
25: }
26: }
|