public 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.
Type Params | Return Type | Name and description |
---|---|---|
|
public static List<Thread> |
allThreads(Thread self) Get all threads |
|
public static File |
createTempDir(File self) |
|
public static File |
createTempDir(File self, String prefix) |
|
public static File |
createTempDir(File self, String prefix, String suffix) |
|
public static long |
currentTimeSeconds(System self) Get the current time in seconds |
|
public static String |
dumpAll(Thread self) Dump the thread dump of all threads |
|
public static ResourceBundle |
getBundle(ResourceBundle self, String bundleName) Works exactly like ResourceBundle.getBundle(String). |
|
public static ResourceBundle |
getBundle(ResourceBundle self, String bundleName, Locale locale) Works exactly like ResourceBundle.getBundle(String, Locale). |
|
public static Matcher |
getLastMatcher(Matcher self) Get the last hidden matcher that the system used to do a match. |
|
public static void |
sleep(Object self, long milliseconds) Sleep for so many milliseconds, even if interrupted. |
|
public static void |
sleep(Object self, long milliseconds, Closure onInterrupt) Sleep for so many milliseconds, using a given closure for interrupt processing. |
|
public static Thread |
start(Thread self, Closure closure) Start a Thread with the given closure as a Runnable instance. |
|
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. |
|
public static Thread |
startDaemon(Thread self, Closure closure) Start a daemon Thread with the given closure as a Runnable instance. |
|
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. |
Get all threads
self
- placeholder variable used by Groovy categories; ignored for default static methodsGet the current time in seconds
self
- placeholder variable used by Groovy categories; ignored for default static methodsDump the thread dump of all threads
self
- placeholder variable used by Groovy categories; ignored for default static methodsWorks 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.
self
- placeholder variable used by Groovy categories; ignored for default static methodsbundleName
- the name of the bundle.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.
self
- placeholder variable used by Groovy categories; ignored for default static methodsbundleName
- the name of the bundle.locale
- the specific localeGet the last hidden matcher that the system used to do a match.
self
- placeholder variable used by Groovy categories; ignored for default static methodsSleep for so many milliseconds, even if interrupted.
self
- placeholder variable used by Groovy categories; ignored for default static methodsmilliseconds
- the number of milliseconds to sleepSleep for so many milliseconds, using a given closure for interrupt processing.
self
- placeholder variable used by Groovy categories; ignored for default static methodsmilliseconds
- the number of milliseconds to sleeponInterrupt
- interrupt handler, InterruptedException is passed to the Closure
as long as it returns false, the sleep continuesStart a Thread with the given closure as a Runnable instance.
self
- placeholder variable used by Groovy categories; ignored for default static methodsclosure
- the Runnable closureStart a Thread with a given name and the given closure as a Runnable instance.
self
- placeholder variable used by Groovy categories; ignored for default static methodsname
- the name to give the threadclosure
- the Runnable closureStart a daemon Thread with the given closure as a Runnable instance.
self
- placeholder variable used by Groovy categories; ignored for default static methodsclosure
- the Runnable closureStart a daemon Thread with a given name and the given closure as a Runnable instance.
self
- placeholder variable used by Groovy categories; ignored for default static methodsname
- the name to give the threadclosure
- the Runnable closure