}
public VariableResolver createVariable(String name, Object value, Class<?> type) {
if (indexedVariableNames == null) return super.createVariable(name, value, type);
VariableResolver vr;
boolean newVar = false;
try {
int idx;
if ((idx = variableIndexOf(name)) != -1) {
vr = new SimpleValueResolver(value);
if (indexedVariableResolvers[idx] == null) {
indexedVariableResolvers[idx] = vr;
}
variableResolvers.put(indexedVariableNames[idx], vr);
vr = indexedVariableResolvers[idx];
newVar = true;
}
else {
return super.createVariable(name, value, type);
}
}
catch (UnresolveablePropertyException e) {
vr = null;
}
if (!newVar && vr != null && vr.getType() != null) {
throw new RuntimeException("variable already defined within scope: " + vr.getType() + " " + name);
}
else {
addResolver(name, vr = new MapVariableResolver(variables, name, type)).setValue(value);
return vr;
}