Groovy 1.7.0

org.codehaus.groovy.runtime
Class DefaultGroovyStaticMethods

java.lang.Object
  org.codehaus.groovy.runtime.DefaultGroovyStaticMethods

class DefaultGroovyStaticMethods
extends Object

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: 15216 $


Constructor Summary
DefaultGroovyStaticMethods()

 
Method Summary
static ResourceBundle getBundle(ResourceBundle self, String bundleName)

Works exactly like ResourceBundle.getBundle(String).

static ResourceBundle getBundle(ResourceBundle self, String bundleName, Locale locale)

Works exactly like ResourceBundle.getBundle(String, Locale).

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)

Parse a String into a Date instance using the given pattern.

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 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.

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

Constructor Detail

DefaultGroovyStaticMethods

DefaultGroovyStaticMethods()


 
Method Detail

getBundle

public static ResourceBundle getBundle(ResourceBundle self, String bundleName)
Works exactly like ResourceBundle.getBundle(String). This is needed because the java method depends on a particular stack configuration that is not guaranteed in Groovy when calling the Java method.
see:
ResourceBundle#getBundle(String)
param:
self placeholder variable used by Groovy categories; ignored for default static methods
param:
bundleName the name of the bundle.
return:
the resource bundle
since:
1.6.0


getBundle

public static ResourceBundle getBundle(ResourceBundle self, String bundleName, Locale locale)
Works exactly like ResourceBundle.getBundle(String, Locale). This is needed because the java method depends on a particular stack configuration that is not guaranteed in Groovy when calling the Java method.
see:
ResourceBundle#getBundle(String, Locale)
param:
self placeholder variable used by Groovy categories; ignored for default static methods
param:
bundleName the name of the bundle.
param:
locale the speficic locale
return:
the resource bundle
since:
1.6.0


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
since:
1.0


parse

public static Date parse(Date self, String format, String input)
Parse a String into a Date instance using the given pattern. This convenience method acts as a wrapper for SimpleDateFormat.

Note that a new SimpleDateFormat instance is created for every invocation of this method (for thread safety).

see:
SimpleDateFormat#parse(String)
param:
self placeholder variable used by Groovy categories; ignored for default static methods
param:
format pattern used to parse the input string.
param:
input String to be parsed to create the date instance
return:
a new Date instance representing the parsed input string
throws:
ParseException if there is a parse error
since:
1.5.7


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
since:
1.0


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
since:
1.0


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
since:
1.0


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
since:
1.6


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
since:
1.0


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
since:
1.6


 

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