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

Method getVariableImpl

src/bsh/ExternalNameSpace.java:164–199  ·  view source on GitHub ↗
( String name, boolean recurse )

Source from the content-addressed store, hash-verified

162 if they are removed via the extenal map.
163 */
164 protected Variable getVariableImpl( String name, boolean recurse )
165 throws UtilEvalError
166 {
167 // check the external map for the variable name
168 Object value = externalMap.get( name );
169
170 if ( value == null && externalMap.containsKey( name ) )
171 value = Primitive.NULL;
172
173 Variable var;
174 if ( value == null )
175 {
176 // The var is not in external map and it should therefore not be
177 // found in local scope (it may have been removed via the map).
178 // Clear it prophalactically.
179 super.unsetVariable( name );
180
181 // Search parent for var if applicable.
182 var = super.getVariableImpl( name, recurse );
183 } else
184 {
185 // Var in external map may be found in local scope with type and
186 // modifier info.
187 Variable localVar = super.getVariableImpl( name, false );
188
189 // If not in local scope then it was added via the external map,
190 // we'll wrap it and pass it along. Else we'll use the local
191 // version.
192 if ( localVar == null )
193 var = new Variable( name, (Class)null, value, (Modifiers)null );
194 else
195 var = localVar;
196 }
197
198 return var;
199 }
200
201 /**
202 */

Callers

nothing calls this directly

Calls 3

getMethod · 0.65
containsKeyMethod · 0.45
unsetVariableMethod · 0.45

Tested by

no test coverage detected