Package org.codehaus.groovy.runtime
Class DefaultGroovyStaticMethods
java.lang.Object
org.codehaus.groovy.runtime.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.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionallThreads
(Thread self) Get all threadsstatic File
createTempDir
(File self) static File
createTempDir
(File self, String prefix) static File
createTempDir
(File self, String prefix, String suffix) static long
currentTimeSeconds
(System self) Get the current time in secondsstatic String
Dump the thread dump of all threadsstatic 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 void
Sleep for so many milliseconds, even if interrupted.static void
Sleep for so many milliseconds, using a given closure for interrupt processing.static Thread
Start a Thread with the given closure as a Runnable instance.static Thread
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 Details
-
DefaultGroovyStaticMethods
public DefaultGroovyStaticMethods()
-
-
Method Details
-
start
Start a Thread with the given closure as a Runnable instance.- Parameters:
self
- placeholder variable used by Groovy categories; ignored for default static methodsclosure
- the Runnable closure- Returns:
- the started thread
- Since:
- 1.0
-
start
Start a Thread with a given name and the given closure as a Runnable instance.- Parameters:
self
- placeholder variable used by Groovy categories; ignored for default static methodsname
- the name to give the threadclosure
- the Runnable closure- Returns:
- the started thread
- Since:
- 1.6
-
startDaemon
Start a daemon Thread with the given closure as a Runnable instance.- Parameters:
self
- placeholder variable used by Groovy categories; ignored for default static methodsclosure
- the Runnable closure- Returns:
- the started thread
- Since:
- 1.0
-
startDaemon
Start a daemon Thread with a given name and the given closure as a Runnable instance.- Parameters:
self
- placeholder variable used by Groovy categories; ignored for default static methodsname
- the name to give the threadclosure
- the Runnable closure- Returns:
- the started thread
- Since:
- 1.6
-
dumpAll
Dump the thread dump of all threads- Parameters:
self
- placeholder variable used by Groovy categories; ignored for default static methods- Returns:
- the thread dump of all threads
- Since:
- 3.0.0
-
allThreads
Get all threads- Parameters:
self
- placeholder variable used by Groovy categories; ignored for default static methods- Returns:
- all threads
- Since:
- 4.0.16
-
getLastMatcher
Get the last hidden matcher that the system used to do a match.- Parameters:
self
- placeholder variable used by Groovy categories; ignored for default static methods- Returns:
- the last regex matcher
- Since:
- 1.0
-
sleep
Sleep for so many milliseconds, even if interrupted.- Parameters:
self
- placeholder variable used by Groovy categories; ignored for default static methodsmilliseconds
- the number of milliseconds to sleep- Since:
- 1.0
-
sleep
Sleep for so many milliseconds, using a given closure for interrupt processing.- Parameters:
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 continues- Since:
- 1.0
-
getBundle
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.- Parameters:
self
- placeholder variable used by Groovy categories; ignored for default static methodsbundleName
- the name of the bundle.- Returns:
- the resource bundle
- Since:
- 1.6.0
- See Also:
-
getBundle
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.- Parameters:
self
- placeholder variable used by Groovy categories; ignored for default static methodsbundleName
- the name of the bundle.locale
- the specific locale- Returns:
- the resource bundle
- Since:
- 1.6.0
- See Also:
-
createTempDir
- Throws:
IOException
-
createTempDir
- Throws:
IOException
-
createTempDir
- Throws:
IOException
-
currentTimeSeconds
Get the current time in seconds- Parameters:
self
- placeholder variable used by Groovy categories; ignored for default static methods- Returns:
- the difference, measured in seconds, between the current time and midnight, January 1, 1970 UTC.
- See Also:
-