程序包 bsh
类 ExternalNameSpace
java.lang.Object
bsh.NameSpace
bsh.ExternalNameSpace
- 所有已实现的接口:
BshClassManager.Listener
,NameSource
,Serializable
A namespace which maintains an external map of values held in variables in
its scope. This mechanism provides a standard collections based interface
to the namespace as well as a convenient way to export and view values of
the namespace without the ordinary BeanShell wrappers.
Variables are maintained internally in the normal fashion to support
meta-information (such as variable type and visibility modifiers), but
exported and imported in a synchronized way. Variables are exported each
time they are written by BeanShell. Imported variables from the map appear
in the BeanShell namespace as untyped variables with no modifiers and
shadow any previously defined variables in the scope.
Note: this class is inherentely dependent on Java 1.2, however it is not
used directly by the core as other than type NameSpace, so no dependency is
introduced.
- 另请参阅:
-
嵌套类概要
从接口继承的嵌套类/接口 bsh.NameSource
NameSource.Listener
-
字段概要
从类继承的字段 bsh.NameSpace
importedClasses, JAVACODE
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明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 NameSourceVariable[]
getMap()
Get the map view of this namespace.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[]
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
Set the external Map which to which this namespace synchronizes.void
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.从类继承的方法 bsh.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
-
构造器详细资料
-
ExternalNameSpace
public ExternalNameSpace() -
ExternalNameSpace
-
-
方法详细资料
-
getMap
Get the map view of this namespace. -
setMap
Set the external Map which to which this namespace synchronizes. The previous external map is detached from this namespace. Previous map values are retained in the external map, but are removed from the BeanShell namespace. -
unsetVariable
从类复制的说明:NameSpace
Remove the variable from the namespace.- 覆盖:
unsetVariable
在类中NameSpace
-
getVariableNames
从类复制的说明:NameSpace
Get the names of variables defined in this namespace. (This does not show variables in parent namespaces).- 覆盖:
getVariableNames
在类中NameSpace
-
getVariableImpl
从类复制的说明:NameSpace
Locate a variable and return the Variable object with optional recursion through parent name spaces. If this namespace is static, return only static variables.- 覆盖:
getVariableImpl
在类中NameSpace
- 返回:
- the Variable value or null if it is not defined
- 抛出:
UtilEvalError
-
getDeclaredVariables
- 覆盖:
getDeclaredVariables
在类中NameSpace
-
setTypedVariable
public void setTypedVariable(String name, Class type, Object value, Modifiers modifiers) throws UtilEvalError 从类复制的说明:NameSpace
Declare a variable in the local scope and set its initial value. Value may be null to indicate that we would like the default value for the variable type. (e.g. 0 for integer types, null for object types). An existing typed variable may only be set to the same type. If an untyped variable of the same name exists it will be overridden with the new typed var. The set will perform a Types.getAssignableForm() on the value if necessary.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
在类中NameSpace
value
- If value is null, you'll get the default value for the typemodifiers
- may be null- 抛出:
UtilEvalError
- 另请参阅:
-
setMethod
从类复制的说明:NameSpace
Note: this is primarily for internal use.- 覆盖:
setMethod
在类中NameSpace
- 抛出:
UtilEvalError
- 另请参阅:
-
getMethod
从类复制的说明:NameSpace
Get the bsh method matching the specified signature declared in this name space or a parent.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
在类中NameSpace
declaredOnly
- if true then only methods declared directly in this namespace will be found and no inherited or imported methods will be visible.- 返回:
- the BshMethod or null if not found
- 抛出:
UtilEvalError
- 另请参阅:
-
getAllNamesAux
从类复制的说明:NameSpace
Helper for implementing NameSource- 覆盖:
getAllNamesAux
在类中NameSpace
-
clear
public void clear()Clear all variables, methods, and imports from this namespace and clear all values from the external map (via Map clear()). -
putExternalMap
Place an unwrapped value in the external map. BeanShell primitive types are represented by their object wrappers, so it is not possible to differentiate between wrapper types and primitive types via the external Map.
-