MCPcopy Create free account
hub / github.com/beanshell/beanshell / getVariableImpl

Method getVariableImpl

src/bsh/NameSpace.java:572–594  ·  view source on GitHub ↗

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 )

Source from the content-addressed store, hash-verified

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.

Callers 4

setVariableMethod · 0.95
getVariableMethod · 0.95
setTypedVariableMethod · 0.95
weHaveVarMethod · 0.45

Calls 2

getImportedVarMethod · 0.95
getMethod · 0.65

Tested by

no test coverage detected