Groovy 1.7.0

groovy.ui
Class InteractiveShell

java.lang.Object
  groovy.ui.InteractiveShell
All Implemented Interfaces:
Runnable

@Deprecated
class InteractiveShell
extends Object

A simple interactive shell for evaluating groovy expressions on the command line (aka. groovysh).

author:
James Strachan
author:
Chris Poirier
author:
Yuri Schimke
author:
Brian McCallistair
author:
Guillaume Laforge
author:
Dierk Koenig, include the inspect command, June 2005
author:
Jason Dillon
version:
$Revision: 18415 $


Nested Class Summary
class InteractiveShell.CommandNameCompletor

 
Constructor Summary
InteractiveShell()

Default constructor, initializes uses new binding and system streams.

InteractiveShell(InputStream in, PrintStream out, PrintStream err)

Constructs a new InteractiveShell instance

InteractiveShell(Binding binding, InputStream in, PrintStream out, PrintStream err)

Constructs a new InteractiveShell instance

InteractiveShell(ClassLoader parent, Binding binding, InputStream in, PrintStream out, PrintStream err)

Constructs a new InteractiveShell instance

 
Method Summary
static void main(String[] args)

Entry point when called directly.

protected String read()

Reads a single statement from the command line.

protected void reset()

Resets the command-line processing machinery after use.

void run()

Reads commands and statements from input stream and processes them.

void setAfterExecution(Closure afterExecution)

A closure that is executed after the execution of the last script.

void setBeforeExecution(Closure beforeExecution)

A closure that is executed before the exection of a given script

 
Methods inherited from class Object
wait, wait, wait, hashCode, getClass, equals, toString, notify, notifyAll
 

Constructor Detail

InteractiveShell

public InteractiveShell()
Default constructor, initializes uses new binding and system streams.


InteractiveShell

public InteractiveShell(InputStream in, PrintStream out, PrintStream err)
Constructs a new InteractiveShell instance
param:
in The input stream to use
param:
out The output stream to use
param:
err The error stream to use


InteractiveShell

public InteractiveShell(Binding binding, InputStream in, PrintStream out, PrintStream err)
Constructs a new InteractiveShell instance
param:
binding The binding instance
param:
in The input stream to use
param:
out The output stream to use
param:
err The error stream to use


InteractiveShell

public InteractiveShell(ClassLoader parent, Binding binding, InputStream in, PrintStream out, PrintStream err)
Constructs a new InteractiveShell instance
param:
parent The parent ClassLoader
param:
binding The binding instance
param:
in The input stream to use
param:
out The output stream to use
param:
err The error stream to use


 
Method Detail

main

public static void main(String[] args)
Entry point when called directly.


read

protected String read()
Reads a single statement from the command line. Also identifies and processes command shell commands. Returns the command text on success, or null when command processing is complete. NOTE: Changed, for now, to read until 'execute' is issued. At 'execute', the statement must be complete.


reset

protected void reset()
Resets the command-line processing machinery after use.


run

public void run()
Reads commands and statements from input stream and processes them.


setAfterExecution

public void setAfterExecution(Closure afterExecution)
A closure that is executed after the execution of the last script. The result of the execution is passed as the first argument to the closure (the value of 'it')
param:
afterExecution The closure to execute


setBeforeExecution

public void setBeforeExecution(Closure beforeExecution)
A closure that is executed before the exection of a given script
param:
beforeExecution The closure to execute


 

Copyright © 2003-2009 The Codehaus. All rights reserved.