BeanShell Object Management Commands
Prev | Chapter 16. BeanShell Commands | Next

## BeanShell Object Management Commands

- `bind(` |  | ths,
  |  | ths,
  |  | namespace`)`;

  Binds the scripted object `ths` to `namespace`.

- `void clear(``void)`;

  Clear all variables, methods, and imports from this namespace. If this namespace is the root, it will be reset to the default imports.

- `org.gjt.sp.jedit.bsh.This extend(` |  | object`)`;
  |  | object`)`;

  Creates a new BeanShell `This` scripted object that is a child of the parameter `object`.

- `void importObject(` |  | object`)`;
  |  | object`)`;

  Import an object into this namespace. This is somewhat similar to Java 1.5 static class imports, except you can import the methods and fields of a Java object instance into a BeanShell namespace, for example:

      Map map = new HashMap();
          importObject( map );
          put("foo", "bar");
          print( get("foo") ); // "bar"

- `org.gjt.sp.jedit.bsh.This object(` | `void)`; |
  | `void)`; |

  Creates a new BeanShell `This` scripted object which can hold data members. You can use this to create an object for storing miscellaneous crufties, like so:

      crufties = object();
      crufties.foo = "hello world";
      crufties.counter = 5;
      ...

- `setNameSpace(` |  | namespace`)`;
  |  | namespace`)`;

  Set the namespace of the current scope to `namespace`.

- `org.gjt.sp.jedit.bsh.This super(` |  | scopename`)`;
  |  | scopename`)`;

  Returns a reference to the BeanShell `This` object representing the enclosing method scope specified by `scopename`. This method work similar to the `super` keyword but can refer to enclosing scope at higher levels in a hierarchy of scopes.

- `void unset(`String name`)`;

  Removes the variable named by `name` from the current interpreter namespace. This has the effect of “undefining” the variable.

Prev | Up | Next
Script Execution Commands | Home | Other Commands