Java Doc for NameSpace.java in  » Scripting » beanshell » bsh » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Scripting » beanshell » bsh 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   bsh.NameSpace

All known Subclasses:   bsh.ExternalNameSpace,  bsh.BlockNameSpace,
NameSpace
public class NameSpace implements java.io.Serializable,BshClassManager.Listener,NameSource(Code)
A namespace in which methods, variables, and imports (class names) live. This is package public because it is used in the implementation of some bsh commands. However for normal use you should be using methods on bsh.Interpreter to interact with your scripts.

A bsh.This object is a thin layer over a NameSpace that associates it with an Interpreter instance. Together they comprise a Bsh scripted object context.

Note: I'd really like to use collections here, but we have to keep this compatible with JDK1.1



Field Summary
final public static  NameSpaceJAVACODE
    
 SimpleNodecallerInfoNode
     The node associated with the creation of this namespace. This is used support getInvocationLine() and getInvocationText().
 ObjectclassInstance
    
 ClassclassStatic
    
protected  HashtableimportedClasses
    
 booleanisClass
     Note that the namespace is a class body or class instance namespace.
 booleanisMethod
     Note that the namespace is a method body namespace.
 VectornameSourceListeners
    

Constructor Summary
public  NameSpace(NameSpace parent, String name)
    
public  NameSpace(BshClassManager classManager, String name)
    
public  NameSpace(NameSpace parent, BshClassManager classManager, String name)
    

Method Summary
public  voidaddNameSourceListener(NameSource.Listener listener)
     Implements NameSource Add a listener who is notified upon changes to names in this space.
 booleanattemptSetPropertyValue(String propName, Object value, Interpreter interp)
     If a writable property exists for the given name, set it and return true, otherwise do nothing and return false.
 voidcacheClass(String name, Class c)
     Helper that caches class.
public  voidclassLoaderChanged()
    
public  voidclear()
     Clear all variables, methods, and imports from this namespace.
protected  VariablecreateVariable(String name, Object value, Modifiers mods)
    
protected  VariablecreateVariable(String name, Class type, Object value, Modifiers mods)
    
protected  VariablecreateVariable(String name, Class type, LHS lhs)
    
public  voiddoSuperImport()
     Perform "import *;" causing the entire classpath to be mapped.
public  Objectget(String name, Interpreter interpreter)
     Resolve name to an object through this namespace.
public  String[]getAllNames()
    
protected  voidgetAllNamesAux(Vector vec)
    
public  ClassgetClass(String name)
     Load a class through this namespace taking into account imports.
 ObjectgetClassInstance()
    
public  BshClassManagergetClassManager()
    
public  ObjectgetCommand(String name, Class[] argTypes, Interpreter interpreter)
     A command is a scripted method or compiled command class implementing a specified method signature.
public  Variable[]getDeclaredVariables()
    
public  ThisgetGlobal(Interpreter declaringInterpreter)
     Get the top level namespace or this namespace if we are the top.
protected  BshMethodgetImportedMethod(String name, Class[] sig)
    
protected  VariablegetImportedVar(String name)
    
public  intgetInvocationLine()
    
public  StringgetInvocationText()
    
public  BshMethodgetMethod(String name, Class[] sig)
    
public  BshMethodgetMethod(String name, Class[] sig, boolean declaredOnly)
     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.

public  String[]getMethodNames()
     Get the names of methods declared in this namespace.
public  BshMethod[]getMethods()
     Get the methods defined in this namespace.
public  StringgetName()
     The name of this namespace.
 NamegetNameResolver(String ambigname)
     This is the factory for Name objects which resolve names within this namespace (e.g.
 SimpleNodegetNode()
    
 StringgetPackage()
    
public  NameSpacegetParent()
     Get the parent namespace.
 ObjectgetPropertyValue(String propName, Interpreter interp)
     Get a property from a scripted object or Primitive.VOID if no such property exists.
public  ThisgetSuper(Interpreter declaringInterpreter)
     Get the parent namespace' This reference or this namespace' This reference if we are the top.
public  ThisgetThis(Interpreter declaringInterpreter)
     A This object is a thin layer over a namespace, comprising a bsh object context.
public  ObjectgetVariable(String name)
     Get the specified variable in this namespace or a parent namespace.

Note: this method is primarily intended for use internally.

public  ObjectgetVariable(String name, boolean recurse)
     Get the specified variable in this namespace.
Parameters:
  recurse - If recurse is true then we recursively search through parent namespaces for the variable.

Note: this method is primarily intended for use internally.

protected  VariablegetVariableImpl(String name, boolean recurse)
     Locate a variable and return the Variable object with optional recursion through parent name spaces.
public  String[]getVariableNames()
     Get the names of variables defined in this namespace.
public  ObjectgetVariableOrProperty(String name, Interpreter interp)
    

Get the specified variable or property in this namespace or a parent namespace.

public static  ClassidentifierToClass(ClassIdentifier ci)
     This is a helper method for working inside of bsh scripts and commands. In that context it is impossible to see a ClassIdentifier object for what it is.
public  voidimportClass(String name)
     Import a class name.
public  voidimportCommands(String name)
     Import scripted or compiled BeanShell commands in the following package in the classpath.
public  voidimportObject(Object obj)
     Import a compiled Java object's methods and variables into this namespace.
public  voidimportPackage(String name)
    
public  voidimportStatic(Class clas)
    
public  ObjectinvokeMethod(String methodName, Object[] args, Interpreter interpreter)
     Invoke a method in this namespace with the specified args and interpreter reference.
public  ObjectinvokeMethod(String methodName, Object[] args, Interpreter interpreter, CallStack callstack, SimpleNode callerInfo)
    
public  voidloadDefaultImports()
     Import standard packages.
public  voidnameSpaceChanged()
    
public  voidprune()
    
 voidsetClassInstance(Object instance)
    
 voidsetClassManager(BshClassManager classManager)
    
 voidsetClassStatic(Class clas)
    
 voidsetLocalVariable(String name, Object value, boolean strictJava)
     Set a variable explicitly in the local scope.
 voidsetLocalVariableOrProperty(String name, Object value, boolean strictJava)
     Set a variable or property explicitly in the local scope.

Sets a variable or property.

public  voidsetMethod(String name, BshMethod method)
     Note: this is primarily for internal use.
public  voidsetName(String name)
    
 voidsetNode(SimpleNode node)
     Set the node associated with the creation of this namespace.
 voidsetPackage(String packageName)
     Set the package name for classes defined in this namespace.
public  voidsetParent(NameSpace parent)
    
public  voidsetTypedVariable(String name, Class type, Object value, boolean isFinal)
    
public  voidsetTypedVariable(String name, Class type, Object value, Modifiers modifiers)
     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.
public  voidsetVariable(String name, Object value, boolean strictJava)
     Set the variable through this namespace. This method obeys the LOCALSCOPING property to determine how variables are set.

Note: this method is primarily intended for use internally.

 voidsetVariable(String name, Object value, boolean strictJava, boolean recurse)
     Set the value of a the variable 'name' through this namespace. The variable may be an existing or non-existing variable. It may live in this namespace or in a parent namespace if recurse is true.

Note: This method is not public and does *not* know about LOCALSCOPING. Its caller methods must set recurse intelligently in all situations (perhaps based on LOCALSCOPING).

Note: this method is primarily intended for use internally.

public  voidsetVariableOrProperty(String name, Object value, boolean strictJava)
    

Sets a variable or property.

 voidsetVariableOrProperty(String name, Object value, boolean strictJava, boolean recurse)
     Set the value of a the variable or property 'name' through this namespace.

Sets a variable or property.

public  StringtoString()
    
public  voidunsetVariable(String name)
     Remove the variable from the namespace.
protected  ObjectunwrapVariable(Variable var)
     Unwrap a variable to its value. return the variable value.

Field Detail
JAVACODE
final public static NameSpace JAVACODE(Code)



callerInfoNode
SimpleNode callerInfoNode(Code)
The node associated with the creation of this namespace. This is used support getInvocationLine() and getInvocationText().



classInstance
Object classInstance(Code)



classStatic
Class classStatic(Code)



importedClasses
protected Hashtable importedClasses(Code)



isClass
boolean isClass(Code)
Note that the namespace is a class body or class instance namespace. This is used for controlling static/object import precedence, etc.



isMethod
boolean isMethod(Code)
Note that the namespace is a method body namespace. This is used for printing stack traces in exceptions.



nameSourceListeners
Vector nameSourceListeners(Code)




Constructor Detail
NameSpace
public NameSpace(NameSpace parent, String name)(Code)



NameSpace
public NameSpace(BshClassManager classManager, String name)(Code)



NameSpace
public NameSpace(NameSpace parent, BshClassManager classManager, String name)(Code)




Method Detail
addNameSourceListener
public void addNameSourceListener(NameSource.Listener listener)(Code)
Implements NameSource Add a listener who is notified upon changes to names in this space.



attemptSetPropertyValue
boolean attemptSetPropertyValue(String propName, Object value, Interpreter interp) throws UtilEvalError(Code)
If a writable property exists for the given name, set it and return true, otherwise do nothing and return false.



cacheClass
void cacheClass(String name, Class c)(Code)
Helper that caches class.



classLoaderChanged
public void classLoaderChanged()(Code)
Clear all cached classes and names



clear
public void clear()(Code)
Clear all variables, methods, and imports from this namespace. If this namespace is the root, it will be reset to the default imports.
See Also:   NameSpace.loadDefaultImports()



createVariable
protected Variable createVariable(String name, Object value, Modifiers mods) throws UtilEvalError(Code)



createVariable
protected Variable createVariable(String name, Class type, Object value, Modifiers mods) throws UtilEvalError(Code)



createVariable
protected Variable createVariable(String name, Class type, LHS lhs) throws UtilEvalError(Code)



doSuperImport
public void doSuperImport() throws UtilEvalError(Code)
Perform "import *;" causing the entire classpath to be mapped. This can take a while.



get
public Object get(String name, Interpreter interpreter) throws UtilEvalError(Code)
Resolve name to an object through this namespace.



getAllNames
public String[] getAllNames()(Code)
Implements NameSource all variable and method names in this and all parentnamespaces



getAllNamesAux
protected void getAllNamesAux(Vector vec)(Code)
Helper for implementing NameSource



getClass
public Class getClass(String name) throws UtilEvalError(Code)
Load a class through this namespace taking into account imports. The class search will proceed through the parent namespaces if necessary. null if not found.



getClassInstance
Object getClassInstance() throws UtilEvalError(Code)



getClassManager
public BshClassManager getClassManager()(Code)



getCommand
public Object getCommand(String name, Class[] argTypes, Interpreter interpreter) throws UtilEvalError(Code)
A command is a scripted method or compiled command class implementing a specified method signature. Commands are loaded from the classpath and may be imported using the importCommands() method.

This method searches the imported commands packages for a script or command object corresponding to the name of the method. If it is a script the script is sourced into this namespace and the BshMethod for the requested signature is returned. If it is a compiled class the class is returned. (Compiled command classes implement static invoke() methods).

The imported packages are searched in reverse order, so that later imports take priority. Currently only the first object (script or class) with the appropriate name is checked. If another, overloaded form, is located in another package it will not currently be found. This could be fixed.

a BshMethod, Class, or null if no such command is found.
Parameters:
  name - is the name of the desired command method
Parameters:
  argTypes - is the signature of the desired command method.
throws:
  UtilEvalError - if loadScriptedCommand throws UtilEvalErrori.e. on errors loading a script that was found




getDeclaredVariables
public Variable[] getDeclaredVariables()(Code)



getGlobal
public This getGlobal(Interpreter declaringInterpreter)(Code)
Get the top level namespace or this namespace if we are the top. Note: this method should probably return type bsh.This to be consistent with getThis();



getImportedMethod
protected BshMethod getImportedMethod(String name, Class[] sig) throws UtilEvalError(Code)



getImportedVar
protected Variable getImportedVar(String name) throws UtilEvalError(Code)



getInvocationLine
public int getInvocationLine()(Code)



getInvocationText
public String getInvocationText()(Code)



getMethod
public BshMethod getMethod(String name, Class[] sig) throws UtilEvalError(Code)

See Also:   NameSpace.getMethod(String,Class[],boolean)
See Also:   NameSpace.getMethod(String,Class[])



getMethod
public BshMethod getMethod(String name, Class[] sig, boolean declaredOnly) throws UtilEvalError(Code)
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.
See Also:   bsh.Primitive the BshMethod or null if not found
Parameters:
  declaredOnly - if true then only methods declared directly in thisnamespace will be found and no inherited or imported methods willbe visible.




getMethodNames
public String[] getMethodNames()(Code)
Get the names of methods declared in this namespace. (This does not include methods in parent namespaces).



getMethods
public BshMethod[] getMethods()(Code)
Get the methods defined in this namespace. (This does not show methods in parent namespaces). Note: This will probably be renamed getDeclaredMethods()



getName
public String getName()(Code)
The name of this namespace. If the namespace is a method body namespace then this is the name of the method. If it's a class or class instance then it's the name of the class.



getNameResolver
Name getNameResolver(String ambigname)(Code)
This is the factory for Name objects which resolve names within this namespace (e.g. toObject(), toClass(), toLHS()).

This was intended to support name resolver caching, allowing Name objects to cache info about the resolution of names for performance reasons. However this not proven useful yet.

We'll leave the caching as it will at least minimize Name object creation.

(This method would be called getName() if it weren't already used for the simple name of the NameSpace)

This method was public for a time, which was a mistake. Use get() instead.




getNode
SimpleNode getNode()(Code)



getPackage
String getPackage()(Code)



getParent
public NameSpace getParent()(Code)
Get the parent namespace. Note: this isn't quite the same as getSuper(). getSuper() returns 'this' if we are at the root namespace.



getPropertyValue
Object getPropertyValue(String propName, Interpreter interp) throws UtilEvalError(Code)
Get a property from a scripted object or Primitive.VOID if no such property exists.
throws:
  UtilEvalError -
throws:
  UtilEvalError -



getSuper
public This getSuper(Interpreter declaringInterpreter)(Code)
Get the parent namespace' This reference or this namespace' This reference if we are the top.



getThis
public This getThis(Interpreter declaringInterpreter)(Code)
A This object is a thin layer over a namespace, comprising a bsh object context. It handles things like the interface types the bsh object supports and aspects of method invocation on it.

The declaringInterpreter is here to support callbacks from Java through generated proxies. The scripted object "remembers" who created it for things like printing messages and other per-interpreter phenomenon when called externally from Java.




getVariable
public Object getVariable(String name) throws UtilEvalError(Code)
Get the specified variable in this namespace or a parent namespace.

Note: this method is primarily intended for use internally. If you use this method outside of the bsh package you will have to use Primitive.unwrap() to get primitive values.
See Also:   Primitive.unwrap(Object) The variable value or Primitive.VOID if it is not defined.




getVariable
public Object getVariable(String name, boolean recurse) throws UtilEvalError(Code)
Get the specified variable in this namespace.
Parameters:
  recurse - If recurse is true then we recursively search through parent namespaces for the variable.

Note: this method is primarily intended for use internally. If you usethis method outside of the bsh package you will have to use Primitive.unwrap() to get primitive values.
See Also:   Primitive.unwrap(Object) The variable value or Primitive.VOID if it is not defined.




getVariableImpl
protected Variable getVariableImpl(String name, boolean recurse) throws UtilEvalError(Code)
Locate a variable and return the Variable object with optional recursion through parent name spaces.

If this namespace is static, return only static variables. the Variable value or null if it is not defined




getVariableNames
public String[] getVariableNames()(Code)
Get the names of variables defined in this namespace. (This does not show variables in parent namespaces).



getVariableOrProperty
public Object getVariableOrProperty(String name, Interpreter interp) throws UtilEvalError(Code)

Get the specified variable or property in this namespace or a parent namespace.

We first search for a variable name, and then a property.

The variable or property value or Primitive.VOID if neither isdefined.



identifierToClass
public static Class identifierToClass(ClassIdentifier ci)(Code)
This is a helper method for working inside of bsh scripts and commands. In that context it is impossible to see a ClassIdentifier object for what it is. Attempting to access a method on a ClassIdentifier will look like a static method invocation. This method is in NameSpace for convenience (you don't have to import bsh.ClassIdentifier to use it );



importClass
public void importClass(String name)(Code)
Import a class name. Subsequent imports override earlier ones



importCommands
public void importCommands(String name)(Code)
Import scripted or compiled BeanShell commands in the following package in the classpath. You may use either "/" path or "." package notation. e.g. importCommands("/bsh/commands") or importCommands("bsh.commands") are equivalent. If a relative path style specifier is used then it is made into an absolute path by prepending "/".



importObject
public void importObject(Object obj)(Code)
Import a compiled Java object's methods and variables into this namespace. When no scripted method / command or variable is found locally in this namespace method / fields of the object will be checked. Objects are checked in the order of import with later imports taking precedence.




importPackage
public void importPackage(String name)(Code)
subsequent imports override earlier ones



importStatic
public void importStatic(Class clas)(Code)



invokeMethod
public Object invokeMethod(String methodName, Object[] args, Interpreter interpreter) throws EvalError(Code)
Invoke a method in this namespace with the specified args and interpreter reference. No caller information or call stack is required. The method will appear as if called externally from Java.


See Also:    bsh.This.invokeMethod(
See Also:   String methodName, Object [] args, Interpreter interpreter,
See Also:   CallStack callstack, SimpleNode callerInfo, boolean )




invokeMethod
public Object invokeMethod(String methodName, Object[] args, Interpreter interpreter, CallStack callstack, SimpleNode callerInfo) throws EvalError(Code)
This method simply delegates to This.invokeMethod();


See Also:    bsh.This.invokeMethod(
See Also:   String methodName, Object [] args, Interpreter interpreter,
See Also:   CallStack callstack, SimpleNode callerInfo )




loadDefaultImports
public void loadDefaultImports()(Code)
Import standard packages. Currently:
 importClass("bsh.EvalError");
 importClass("bsh.Interpreter");
 importPackage("javax.swing.event");
 importPackage("javax.swing");
 importPackage("java.awt.event");
 importPackage("java.awt");
 importPackage("java.net");
 importPackage("java.util");
 importPackage("java.io");
 importPackage("java.lang");
 importCommands("/bsh/commands");
 



nameSpaceChanged
public void nameSpaceChanged()(Code)
Clear all cached classes and names



prune
public void prune()(Code)
Used for serialization



setClassInstance
void setClassInstance(Object instance)(Code)



setClassManager
void setClassManager(BshClassManager classManager)(Code)



setClassStatic
void setClassStatic(Class clas)(Code)



setLocalVariable
void setLocalVariable(String name, Object value, boolean strictJava) throws UtilEvalError(Code)
Set a variable explicitly in the local scope.



setLocalVariableOrProperty
void setLocalVariableOrProperty(String name, Object value, boolean strictJava) throws UtilEvalError(Code)
Set a variable or property explicitly in the local scope.

Sets a variable or property. See "setLocalVariable" for rules regarding scoping.

We first check for the existence of the variable. If it exists, we set it. If the variable does not exist we look for a property. If the property exists and is writable we set it. Finally, if neither the variable or the property exist, we create a new variable.




setMethod
public void setMethod(String name, BshMethod method) throws UtilEvalError(Code)
Note: this is primarily for internal use.
See Also:   Interpreter.source(String)
See Also:   Interpreter.eval(String)



setName
public void setName(String name)(Code)



setNode
void setNode(SimpleNode node)(Code)
Set the node associated with the creation of this namespace. This is used in debugging and to support the getInvocationLine() and getInvocationText() methods.



setPackage
void setPackage(String packageName)(Code)
Set the package name for classes defined in this namespace. Subsequent sets override the package.



setParent
public void setParent(NameSpace parent)(Code)



setTypedVariable
public void setTypedVariable(String name, Class type, Object value, boolean isFinal) throws UtilEvalError(Code)



setTypedVariable
public void setTypedVariable(String name, Class type, Object value, Modifiers modifiers) throws UtilEvalError(Code)
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.
See Also:   bsh.Primitive
Parameters:
  value - If value is null, you'll get the default value for the type
Parameters:
  modifiers - may be null




setVariable
public void setVariable(String name, Object value, boolean strictJava) throws UtilEvalError(Code)
Set the variable through this namespace. This method obeys the LOCALSCOPING property to determine how variables are set.

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.
See Also:   bsh.Primitive
See Also:   


See Also:   Setting a new variable (which didn't exist before) or removing
See Also:   a variable causes a namespace change.
Parameters:
  strictJava - specifies whether strict java rules are applied.




setVariable
void setVariable(String name, Object value, boolean strictJava, boolean recurse) throws UtilEvalError(Code)
Set the value of a the variable 'name' through this namespace. The variable may be an existing or non-existing variable. It may live in this namespace or in a parent namespace if recurse is true.

Note: This method is not public and does *not* know about LOCALSCOPING. Its caller methods must set recurse intelligently in all situations (perhaps based on LOCALSCOPING).

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.
See Also:   bsh.Primitive
See Also:   


See Also:   Setting a new variable (which didn't exist before) or removing
See Also:   a variable causes a namespace change.
Parameters:
  strictJava - specifies whether strict java rules are applied.
Parameters:
  recurse - determines whether we will search for the variable inour parent's scope before assigning locally.




setVariableOrProperty
public void setVariableOrProperty(String name, Object value, boolean strictJava) throws UtilEvalError(Code)

Sets a variable or property. See "setVariable" for rules regarding scoping.

We first check for the existence of the variable. If it exists, we set it. If the variable does not exist we look for a property. If the property exists and is writable we set it. Finally, if neither the variable or the property exist, we create a new variable.


Parameters:
  strictJava - specifies whether strict java rules are applied.



setVariableOrProperty
void setVariableOrProperty(String name, Object value, boolean strictJava, boolean recurse) throws UtilEvalError(Code)
Set the value of a the variable or property 'name' through this namespace.

Sets a variable or property. See "setVariableOrProperty" for rules regarding scope.

We first check for the existence of the variable. If it exists, we set it. If the variable does not exist we look for a property. If the property exists and is writable we set it. Finally, if neither the variable or the property exist, we create a new variable.


Parameters:
  strictJava - specifies whether strict java rules are applied.
Parameters:
  recurse - determines whether we will search for the variable inour parent's scope before assigning locally.



toString
public String toString()(Code)



unsetVariable
public void unsetVariable(String name)(Code)
Remove the variable from the namespace.



unwrapVariable
protected Object unwrapVariable(Variable var) throws UtilEvalError(Code)
Unwrap a variable to its value. return the variable value. A null var is mapped to Primitive.VOID



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.