Package org.codehaus.groovy.runtime
Class DefaultGroovyStaticMethods
java.lang.Object
org.codehaus.groovy.runtime.DefaultGroovyStaticMethods
public class DefaultGroovyStaticMethods
extends java.lang.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.
- 
Constructor SummaryConstructors Constructor Description DefaultGroovyStaticMethods()
- 
Method SummaryModifier and Type Method Description static java.io.FilecreateTempDir(java.io.File self)static java.io.FilecreateTempDir(java.io.File self, java.lang.String prefix)static java.io.FilecreateTempDir(java.io.File self, java.lang.String prefix, java.lang.String suffix)static longcurrentTimeSeconds(java.lang.System self)Get the current time in secondsstatic java.lang.StringdumpAll(java.lang.Thread self)Dump the thread dump of all threadsstatic java.util.ResourceBundlegetBundle(java.util.ResourceBundle self, java.lang.String bundleName)Works exactly like ResourceBundle.getBundle(String).static java.util.ResourceBundlegetBundle(java.util.ResourceBundle self, java.lang.String bundleName, java.util.Locale locale)Works exactly like ResourceBundle.getBundle(String, Locale).static java.util.regex.MatchergetLastMatcher(java.util.regex.Matcher self)Get the last hidden matcher that the system used to do a match.static java.util.Dateparse(java.util.Date self, java.lang.String format, java.lang.String input)Deprecated.static java.util.Dateparse(java.util.Date self, java.lang.String format, java.lang.String input, java.util.TimeZone zone)Deprecated.static java.util.DateparseToStringDate(java.util.Date self, java.lang.String dateToString)Deprecated.static voidsleep(java.lang.Object self, long milliseconds)Sleep for so many milliseconds, even if interrupted.static voidsleep(java.lang.Object self, long milliseconds, Closure onInterrupt)Sleep for so many milliseconds, using a given closure for interrupt processing.static java.lang.Threadstart(java.lang.Thread self, Closure closure)Start a Thread with the given closure as a Runnable instance.static java.lang.Threadstart(java.lang.Thread self, java.lang.String name, Closure closure)Start a Thread with a given name and the given closure as a Runnable instance.static java.lang.ThreadstartDaemon(java.lang.Thread self, Closure closure)Start a daemon Thread with the given closure as a Runnable instance.static java.lang.ThreadstartDaemon(java.lang.Thread self, java.lang.String name, Closure closure)Start a daemon Thread with a given name and the given closure as a Runnable instance.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
- 
Constructor Details- 
DefaultGroovyStaticMethodspublic DefaultGroovyStaticMethods()
 
- 
- 
Method Details- 
startStart a Thread with the given closure as a Runnable instance.- Parameters:
- self- placeholder variable used by Groovy categories; ignored for default static methods
- closure- the Runnable closure
- Returns:
- the started thread
- Since:
- 1.0
 
- 
startpublic static java.lang.Thread start(java.lang.Thread self, java.lang.String name, Closure closure)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 methods
- name- the name to give the thread
- closure- the Runnable closure
- Returns:
- the started thread
- Since:
- 1.6
 
- 
startDaemonStart a daemon Thread with the given closure as a Runnable instance.- Parameters:
- self- placeholder variable used by Groovy categories; ignored for default static methods
- closure- the Runnable closure
- Returns:
- the started thread
- Since:
- 1.0
 
- 
startDaemonpublic static java.lang.Thread startDaemon(java.lang.Thread self, java.lang.String name, Closure closure)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 methods
- name- the name to give the thread
- closure- the Runnable closure
- Returns:
- the started thread
- Since:
- 1.6
 
- 
dumpAllpublic static java.lang.String dumpAll(java.lang.Thread self)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
 
- 
getLastMatcherpublic static java.util.regex.Matcher getLastMatcher(java.util.regex.Matcher self)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
 
- 
sleeppublic static void sleep(java.lang.Object self, long milliseconds)Sleep for so many milliseconds, even if interrupted.- Parameters:
- self- placeholder variable used by Groovy categories; ignored for default static methods
- milliseconds- the number of milliseconds to sleep
- Since:
- 1.0
 
- 
sleepSleep for so many milliseconds, using a given closure for interrupt processing.- Parameters:
- self- placeholder variable used by Groovy categories; ignored for default static methods
- milliseconds- the number of milliseconds to sleep
- onInterrupt- interrupt handler, InterruptedException is passed to the Closure as long as it returns false, the sleep continues
- Since:
- 1.0
 
- 
parse@Deprecated public static java.util.Date parse(java.util.Date self, java.lang.String format, java.lang.String input) throws java.text.ParseExceptionDeprecated.- Throws:
- java.text.ParseException
 
- 
parse@Deprecated public static java.util.Date parse(java.util.Date self, java.lang.String format, java.lang.String input, java.util.TimeZone zone) throws java.text.ParseExceptionDeprecated.- Throws:
- java.text.ParseException
 
- 
parseToStringDate@Deprecated public static java.util.Date parseToStringDate(java.util.Date self, java.lang.String dateToString) throws java.text.ParseExceptionDeprecated.- Throws:
- java.text.ParseException
 
- 
getBundlepublic static java.util.ResourceBundle getBundle(java.util.ResourceBundle self, java.lang.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.- Parameters:
- self- placeholder variable used by Groovy categories; ignored for default static methods
- bundleName- the name of the bundle.
- Returns:
- the resource bundle
- Since:
- 1.6.0
- See Also:
- ResourceBundle.getBundle(java.lang.String)
 
- 
getBundlepublic static java.util.ResourceBundle getBundle(java.util.ResourceBundle self, java.lang.String bundleName, java.util.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.- Parameters:
- self- placeholder variable used by Groovy categories; ignored for default static methods
- bundleName- the name of the bundle.
- locale- the specific locale
- Returns:
- the resource bundle
- Since:
- 1.6.0
- See Also:
- ResourceBundle.getBundle(java.lang.String, java.util.Locale)
 
- 
createTempDirpublic static java.io.File createTempDir(java.io.File self) throws java.io.IOException- Throws:
- java.io.IOException
 
- 
createTempDirpublic static java.io.File createTempDir(java.io.File self, java.lang.String prefix) throws java.io.IOException- Throws:
- java.io.IOException
 
- 
createTempDirpublic static java.io.File createTempDir(java.io.File self, java.lang.String prefix, java.lang.String suffix) throws java.io.IOException- Throws:
- java.io.IOException
 
- 
currentTimeSecondspublic static long currentTimeSeconds(java.lang.System self)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:
- System.currentTimeMillis()
 
 
-