Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

bsh.collection.* (2)bsh.commands.* (1)bsh.reflect.* (1)bsh.util.* (1)

bsh: Javadoc index of package bsh.


Package Samples:

bsh.commands
bsh.reflect
bsh.collection
bsh.util

Classes:

Interpreter: The BeanShell script interpreter. An instance of Interpreter can be used to source scripts and evaluate statements or expressions. Here are some examples: Interpeter bsh = new Interpreter(); // Evaluate statements and expressions bsh.eval("foo=Math.sin(0.5)"); bsh.eval("bar=foo*5; bar=Math.cos(bar);"); bsh.eval("for(i=0; i In the above examples we showed a single interpreter instance, however you may wish to use many instances, depending on the application and how you structure your scripts. Interpreter instances are very light weight to create, however if you are going to execute the same script ...
CallStack: A stack of NameSpaces representing the call path. Each method invocation, for example, pushes a new NameSpace onto the stack. The top of the stack is always the current namespace of evaluation. This is used to support the this.caller magic reference and to print script "stack traces" when evaluation errors occur. Note: it would be awefully nice to use the java.util.Stack here. Sigh... have to stay 1.1 compatible. Note: How can this be thread safe, you might ask? Wouldn't a thread executing various beanshell methods be mutating the callstack? Don't we need one CallStack per Thread in the interpreter? ...
UtilEvalError: UtilEvalError is an error corresponding to an EvalError but thrown by a utility or other class that does not have the caller context (Node) available to it. A normal EvalError must supply the caller Node in order for error messages to be pinned to the correct line and location in the script. UtilEvalError is a checked exception that is *not* a subtype of EvalError, but instead must be caught and rethrown as an EvalError by the a nearest location with context. The method toEvalError( Node ) should be used to throw the EvalError, supplying the node. To summarize: Utilities throw UtilEvalError. ASTs ...
Parser: This is the BeanShell parser. It is used internally by the Interpreter class (which is probably what you are looking for). The parser knows only how to parse the structure of the language, it does not understand names, commands, etc. You can use the Parser from the command line to do basic structural validation of BeanShell files without actually executing them. e.g. java bsh.Parser [ -p ] file [ file ] [ ... ] The -p option causes the abstract syntax to be printed. From code you'd use the Parser like this: Parser parser = new Parser(in); while( !(eof=parser.Line()) ) { SimpleNode node = parser.popNode(); ...
Name: What's in a name? I'll tell you... Name() is a somewhat ambiguous thing in the grammar and so is this. This class is a name resolver. It holds a possibly ambiguous dot separated name and reference to a namespace in which it allegedly lives. It provides methods that attempt to resolve the name to various types of entities: e.g. an Object, a Class, a declared scripted BeanShell method. Name objects are created by the factory method NameSpace getNameResolver(), which caches them subject to a class namespace change. This means that we can cache information about various types of resolution here. Currently ...
JThis: JThis is a dynamically loaded extension which extends This and adds explicit support for AWT and JFC events, etc. This is a backwards compatability measure for JDK 1.2. With 1.3+ there is a general reflection proxy mechanism that allows the base This to implement arbitrary interfaces. The NameSpace getThis() method will produce instances of JThis if the java version is prior to 1.3 and swing is available... (e.g. 1.2 or 1.1 + swing installed) Users of 1.1 without swing will have minimal interface support (just run()). Bsh doesn't run on 1.02 and below because there is no reflection! Note: This ...
ClassNameSpace: A ClassNameSpace represents the body a scripted class definition or scripted class instance. In the case of the class definition it serves as the Class object and holds the class initializer method (called before the constructor). When serving as a class definition, only static members are visible and attempting to access an instance member will cause a "can't reach instance from static context" exception. When serving as a class instance static members are dissallowed (except by the initializer) and are ignored, allowing them to be seen in the class definition. Class instances also serve as the ...
XThis: XThis is a dynamically loaded extension which extends This.java and adds support for the generalized interface proxy mechanism introduced in JDK1.3. XThis allows bsh scripted objects to implement arbitrary interfaces (be arbitrary event listener types). Note: This module relies on new features of JDK1.3 and will not compile with JDK1.2 or lower. For those environments simply do not compile this class. Eventually XThis should become simply This, but for backward compatability we will maintain This without requiring support for the proxy mechanism. XThis stands for "eXtended This" (I had to call ...
NameSource: This interface supports name completion, which is used primarily for command line tools, etc. It provides a flat source of "names" in a space. For example all of the classes in the classpath or all of the variables in a namespace (or all of those). NameSource is the lightest weight mechanism for sources which wish to support name completion. In the future it might be better for NameSpace to implement NameCompletion directly in a more native and efficient fasion. However in general name competion is used for human interaction and therefore does not require high performance.
ForBodyNameSpace: A specialized namespace for the body of a "for" statement. The for statement body acts like a child namespace but only for variables declared or initialized in the forInit() section. Elsewhere variable assignment acts like it is part of the containing block. This namespace takes as an argument a namespace comprising the forInit() variables and allows variables within it to shadow those in the parent namespace. Otherwise all assignments are delegated to the parent namespace. There may be more methods from NameSpace that should be overidden here.
Reflect: All of the reflection API code lies here. It is in the form of static utilities. Maybe this belongs in LHS.java or a generic object wrapper class. Note: More work to do in here to fix up the extended signature matching. need to work in a search along with findMostSpecificSignature... Note: there are lots of cases here where the Java reflection API makes us catch exceptions (e.g. NoSuchFieldException) in order to do basic searching. This has to be inefficient... I wish they would add a more normal Java API for locating fields.
TargetError: TargetError is an EvalError that wraps an exception thrown by the script (or by code called from the script). TargetErrors indicate exceptions which can be caught within the script itself, whereas a general EvalError indicates that the script cannot be evaluated further for some reason. If the exception is caught within the script it is automatically unwrapped, so the code looks like normal Java code. If the TargetError is thrown from the eval() or interpreter.eval() method it may be caught and unwrapped to determine what exception was thrown.
NameSpace: 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
BshClassManager: BshClassManager manages all classloading in BeanShell. It also supports a dynamically loaded extension (bsh.classpath package) which allows classpath extension and class file reloading. Currently the extension relies on 1.2 for BshClassLoader and weak references. See http://www.beanshell.org/manual/classloading.html for details on the bsh classloader architecture. Bsh has a multi-tiered class loading architecture. No class loader is used unless/until the classpath is modified or a class is reloaded.
LHS: An LHS is a wrapper for an variable, field, or property. It ordinarily holds the "left hand side" of an assignment and may be either resolved to a value or assigned a value. There is one special case here termed METHOD_EVAL where the LHS is used in an intermediate evaluation of a chain of suffixes and wraps a method invocation. In this case it may only be resolved to a value and cannot be assigned. (You can't assign a value to the result of a method call e.g. "foo() = 5;").
BshMethod: This represents an instance of a bsh method declaration in a particular namespace. This is a thin wrapper around the BSHMethodDeclaration with a pointer to the declaring namespace. When a method is located in a subordinate namespace or invoked from an arbitrary namespace it must nontheless execute with its 'super' as the context in which it was declared.
BlockNameSpace: A specialized namespace for Blocks (e.g. the body of a "for" statement). The Block acts like a child namespace but only for typed variables declared within it (block local scope) or untyped variables explicitly set in it via setBlockVariable(). Otherwise variable assignment (including untyped variable usage) acts like it is part of the containing block.
File: A File that supports localized paths using the bsh current working directory (bsh.cwd) Also adds basename/dirname functionality. Note: This kind of crosses the line between the core interpreter and the "util" package. It's here so that we're consistent in the source() feature of the interpreter.
BSHEnhancedForStatement: Implementation of the enhanced for(:) statement. This statement uses BshIterable to support iteration over a wide variety of iterable types. Under JDK 1.1 this statement supports primitive and Object arrays, Vectors, and enumerations. Under JDK 1.2 and later it additionally supports collections.
CommandLineReader: This is a quick hack to turn empty lines entered interactively on the command line into ';\n' empty lines for the interpreter. It's just more pleasant to be able to hit return on an empty line and see the prompt reappear. This is *not* used when text is sourced from a file non-interactively.
Capabilities: The map of extended features supported by the runtime in which we live. This class should be independent of all other bsh classes! Note that tests for class existence here do *not* use the BshClassManager, as it may require other optional class files to be loaded.
This: 'This' is the type of bsh scripted objects. A 'This' object is a bsh scripted object context. It holds a namespace reference and implements event listeners and various other interfaces. This holds a reference to the declaring interpreter for callbacks from outside of bsh.
ParseException: This exception is thrown when parse errors are encountered. You can explicitly create objects of this exception type by calling the method generateParseException in the generated parser. You can modify this class to customize your error reporting mechanisms so long as you retain the public fields.
ReflectManagerImpl: This is the implementation of: ReflectManager - a dynamically loaded extension that supports extended reflection features supported by JDK1.2 and greater. In particular it currently supports accessible method and field access supported by JDK1.2 and greater.

Home | Contact Us | Privacy Policy | Terms of Service