public class ExternalNameSpace extends NameSpace
NameSource.Listener
importedClasses, JAVACODE
Constructor and Description |
---|
ExternalNameSpace() |
ExternalNameSpace(NameSpace parent,
String name,
Map externalMap) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear all variables, methods, and imports from this namespace and clear
all values from the external map (via Map clear()).
|
protected void |
getAllNamesAux(Vector vec)
Helper for implementing NameSource
|
Variable[] |
getDeclaredVariables() |
Map |
getMap()
Get the map view of this namespace.
|
BshMethod |
getMethod(String name,
Class[] sig,
boolean declaredOnly)
Get the bsh method matching the specified signature declared in
this name space or a parent.
|
protected Variable |
getVariableImpl(String name,
boolean recurse)
Locate a variable and return the Variable object with optional
recursion through parent name spaces.
|
String[] |
getVariableNames()
Get the names of variables defined in this namespace.
|
protected void |
putExternalMap(String name,
Object value)
Place an unwrapped value in the external map.
|
void |
setMap(Map map)
Set the external Map which to which this namespace synchronizes.
|
void |
setMethod(String name,
BshMethod method)
Note: this is primarily for internal use.
|
void |
setTypedVariable(String name,
Class type,
Object value,
Modifiers modifiers)
Declare a variable in the local scope and set its initial value.
|
void |
unsetVariable(String name)
Remove the variable from the namespace.
|
addNameSourceListener, classLoaderChanged, doSuperImport, get, getAllNames, getClass, getClassManager, getCommand, getGlobal, getImportedMethod, getImportedVar, getInvocationLine, getInvocationText, getMethod, getMethodNames, getMethods, getName, getParent, getSuper, getVariable, getVariable, identifierToClass, importClass, importCommands, importObject, importPackage, importStatic, invokeMethod, invokeMethod, loadDefaultImports, nameSpaceChanged, prune, setName, setParent, setTypedVariable, setVariable, toString, unwrapVariable
public Map getMap()
public void setMap(Map map)
public void unsetVariable(String name)
NameSpace
unsetVariable
in class NameSpace
public String[] getVariableNames()
NameSpace
getVariableNames
in class NameSpace
protected Variable getVariableImpl(String name, boolean recurse) throws UtilEvalError
NameSpace
getVariableImpl
in class NameSpace
UtilEvalError
public Variable[] getDeclaredVariables()
getDeclaredVariables
in class NameSpace
public void setTypedVariable(String name, Class type, Object value, Modifiers modifiers) throws UtilEvalError
NameSpace
Note: this method is primarily intended for use internally. If you use this method outside of the bsh package and wish to set variables with primitive values you will have to wrap them using bsh.Primitive.
setTypedVariable
in class NameSpace
value
- If value is null, you'll get the default value for the typemodifiers
- may be nullUtilEvalError
Primitive
public void setMethod(String name, BshMethod method) throws UtilEvalError
NameSpace
setMethod
in class NameSpace
UtilEvalError
Interpreter.source( String )
,
Interpreter.eval( String )
public BshMethod getMethod(String name, Class[] sig, boolean declaredOnly) throws UtilEvalError
NameSpace
Note: this method is primarily intended for use internally. If you use this method outside of the bsh package you will have to be familiar with BeanShell's use of the Primitive wrapper class.
getMethod
in class NameSpace
declaredOnly
- if true then only methods declared directly in this
namespace will be found and no inherited or imported methods will
be visible.UtilEvalError
Primitive
protected void getAllNamesAux(Vector vec)
NameSpace
getAllNamesAux
in class NameSpace
public void clear()
clear
in class NameSpace
NameSpace.loadDefaultImports()
? 2000-2005 pat@pat.net :-)