VariableScope#getVariables

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2011 01:27 AM
Hi
I've gone through the implementation of org.activiti.engine.delegate.VariableScope#getVariables and the following question came up: if the same name is used for a variable on different scopes in the scope hierarchy, why does the variable furthest up the tree have precedence? Intuitively, I would have imagined that a more 'local' scope has precedence.
This is the code I mean:
for (VariableInstanceEntity variableInstance: variableInstances.values()) {
variables.put(variableInstance.getName(), variableInstance.getValue());
}
VariableScopeImpl parentScope = getParentVariableScope();
if (parentScope!=null) {
return parentScope.collectVariables(variables);
}
Thanks for sharing the thoughts behind this implementation 'strategy'.
Regards, Etienne
I've gone through the implementation of org.activiti.engine.delegate.VariableScope#getVariables and the following question came up: if the same name is used for a variable on different scopes in the scope hierarchy, why does the variable furthest up the tree have precedence? Intuitively, I would have imagined that a more 'local' scope has precedence.
This is the code I mean:
for (VariableInstanceEntity variableInstance: variableInstances.values()) {
variables.put(variableInstance.getName(), variableInstance.getValue());
}
VariableScopeImpl parentScope = getParentVariableScope();
if (parentScope!=null) {
return parentScope.collectVariables(variables);
}
Thanks for sharing the thoughts behind this implementation 'strategy'.
Regards, Etienne
Labels:
- Labels:
-
Archive
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2011 06:03 AM
Etienne,
Can you please use the userforum for questions like this?
Can you please use the userforum for questions like this?

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2011 05:08 AM
Hi Ronald
Ok. Will do.
Thanks and regards, Etienne
Ok. Will do.
Thanks and regards, Etienne
