org.codehaus.groovy.runtime
Class DefaultGroovyStaticMethods

This class defines all the new static groovy methods which appear on normal JDK classes inside the Groovy environment. Static methods are used with the first parameter as the destination class.

author:
Guillaume Laforge
author:
Dierk Koenig
author:
Joachim Baumann
author:
Paul King
version:
$Revision: 13717 $

 
Constructor Summary
DefaultGroovyStaticMethods()
           
 
Method Summary
static Thread createThread(String name, boolean daemon, Closure closure)
          
static Matcher getLastMatcher(Matcher self)
           Get the last hidden matcher that the system used to do a match.
static Date parse(Date self, String format, String input)
          
static void sleep(Object self, long milliseconds)
           Sleep for so many milliseconds, even if interrupted.
static void sleep(Object self, long milliseconds, Closure onInterrupt)
           Sleep for so many milliseconds, using a given closure for interrupt processing.
static void sleepImpl(long millis, Closure closure)
           This method is used by both sleep() methods to implement sleeping for the given time even if interrupted as long as the closure returns false the sleep continues
static Thread start(Thread self, Closure closure)
           Start a Thread with the given closure as a Runnable instance.
static Thread start(Thread self, String name, Closure closure)
           Start a Thread with a given name and the given closure as a Runnable instance.
static Thread startDaemon(Thread self, Closure closure)
           Start a daemon Thread with the given closure as a Runnable instance.
static Thread startDaemon(Thread self, String name, Closure closure)
           Start a daemon Thread with a given name and the given closure as a Runnable instance.
 

Constructor Detail

DefaultGroovyStaticMethods

DefaultGroovyStaticMethods()


Method Detail

createThread

static Thread createThread(String name, boolean daemon, Closure closure)


getLastMatcher

public static Matcher getLastMatcher(Matcher self)
Get the last hidden matcher that the system used to do a match.
param:
self placeholder variable used by Groovy categories; ignored for default static methods
return:
the last regex matcher


parse

public static Date parse(Date self, String format, String input)


sleep

public static void sleep(Object self, long milliseconds)
Sleep for so many milliseconds, even if interrupted.
param:
self placeholder variable used by Groovy categories; ignored for default static methods
param:
milliseconds the number of milliseconds to sleep


sleep

public static void sleep(Object self, long milliseconds, Closure onInterrupt)
Sleep for so many milliseconds, using a given closure for interrupt processing.
param:
self placeholder variable used by Groovy categories; ignored for default static methods
param:
milliseconds the number of milliseconds to sleep
param:
onInterrupt interrupt handler, InterruptedException is passed to the Closure
as long as it returns false, the sleep continues


sleepImpl

static void sleepImpl(long millis, Closure closure)
This method is used by both sleep() methods to implement sleeping for the given time even if interrupted
param:
millis the number of milliseconds to sleep
param:
closure optional closure called when interrupted
as long as the closure returns false the sleep continues


start

public static Thread start(Thread self, Closure closure)
Start a Thread with the given closure as a Runnable instance.
param:
self placeholder variable used by Groovy categories; ignored for default static methods
param:
closure the Runnable closure
return:
the started thread


start

public static Thread start(Thread self, String name, Closure closure)
Start a Thread with a given name and the given closure as a Runnable instance.
param:
self placeholder variable used by Groovy categories; ignored for default static methods
param:
name the name to give the thread
param:
closure the Runnable closure
return:
the started thread


startDaemon

public static Thread startDaemon(Thread self, Closure closure)
Start a daemon Thread with the given closure as a Runnable instance.
param:
self placeholder variable used by Groovy categories; ignored for default static methods
param:
closure the Runnable closure
return:
the started thread


startDaemon

public static Thread startDaemon(Thread self, String name, Closure closure)
Start a daemon Thread with a given name and the given closure as a Runnable instance.
param:
self placeholder variable used by Groovy categories; ignored for default static methods
param:
name the name to give the thread
param:
closure the Runnable closure
return:
the started thread