Locate a variable and return the Variable object with optional recursion through parent name spaces. If this namespace is static, return only static variables. @return the Variable value or null if it is not defined
( String name, boolean recurse )
| 570 | @return the Variable value or null if it is not defined |
| 571 | */ |
| 572 | protected Variable getVariableImpl( String name, boolean recurse ) |
| 573 | throws UtilEvalError |
| 574 | { |
| 575 | Variable var = null; |
| 576 | |
| 577 | // Change import precedence if we are a class body/instance |
| 578 | // Get imported first. |
| 579 | if ( var == null && isClass ) |
| 580 | var = getImportedVar( name ); |
| 581 | |
| 582 | if ( var == null && variables != null ) |
| 583 | var = (Variable)variables.get(name); |
| 584 | |
| 585 | // Change import precedence if we are a class body/instance |
| 586 | if ( var == null && !isClass ) |
| 587 | var = getImportedVar( name ); |
| 588 | |
| 589 | // try parent |
| 590 | if ( recurse && (var == null) && (parent != null) ) |
| 591 | var = parent.getVariableImpl( name, recurse ); |
| 592 | |
| 593 | return var; |
| 594 | } |
| 595 | |
| 596 | /* |
| 597 | Get variables declared in this namespace. |
no test coverage detected