/** * 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 */ public static Thread startDaemon(Thread self, String name, Closure closure) { return createThread(name, true, closure); }
/** * 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 */ public static void sleep(Object self, long milliseconds, Closure onInterrupt) { sleepImpl(milliseconds, onInterrupt); }
public static File createTempDir(File self) throws IOException { return createTempDir(self, "groovy-generated-", "-tmpdir"); }
/** * 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. * * @param self placeholder variable used by Groovy categories; ignored for default static methods * @param bundleName the name of the bundle. * @return the resource bundle * @see java.util.ResourceBundle#getBundle(java.lang.String) * @since 1.6.0 */ public static ResourceBundle getBundle(ResourceBundle self, String bundleName) { return getBundle(self, bundleName, Locale.getDefault()); }
public static void sleep(Object self, long milliseconds, Closure onInterrupt) { if ((!Caller.isAsynchronous(self, "sleep", milliseconds, onInterrupt))&&(!Caller.isAsynchronous(CpsDefaultGroovyStaticMethods.class, "sleep", self, milliseconds, onInterrupt))) { DefaultGroovyStaticMethods.sleep(self, milliseconds, onInterrupt); return ; } CpsDefaultGroovyStaticMethods.$sleep__java_lang_Object__long__groovy_lang_Closure(self, milliseconds, onInterrupt); }
/** *Tests System.currentTimeSeconds() */ public void testCurrentTimeSeconds() { long timeMillis = System.currentTimeMillis(); long timeSeconds = DefaultGroovyStaticMethods.currentTimeSeconds(null); long timeMillis2 = System.currentTimeMillis(); assertTrue(timeMillis/1000 <= timeSeconds); assertTrue(timeMillis2/1000 >= timeSeconds); } }
/** * 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. * * @param self placeholder variable used by Groovy categories; ignored for default static methods * @param bundleName the name of the bundle. * @return the resource bundle * @see java.util.ResourceBundle#getBundle(java.lang.String) * @since 1.6.0 */ public static ResourceBundle getBundle(ResourceBundle self, String bundleName) { return getBundle(self, bundleName, Locale.getDefault()); }
/** * 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 */ public static Thread start(Thread self, Closure closure) { return createThread(null, false, closure); }
/** * 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 */ public static void sleep(Object self, long milliseconds) { sleepImpl(milliseconds, null); }
/** * Creates a temporary directory in the default temporary directory (as specified by the system * property <i>java.io.tmpdir</i>. * * @deprecated Use {@link DefaultGroovyStaticMethods#createTempDir(java.io.File, String, String)} instead. */ @Deprecated public static File createTempDir() throws IOException { return DefaultGroovyStaticMethods.createTempDir(null); }
/** * 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 */ public static ResourceBundle getBundle(ResourceBundle self, String bundleName) { return getBundle(self,bundleName,Locale.getDefault()); }
/** * 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 */ public static Thread startDaemon(Thread self, Closure closure) { return createThread(null, true, closure); }
/** * 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 */ public static void sleep(Object self, long milliseconds, Closure onInterrupt) { sleepImpl(milliseconds, onInterrupt); }
private File createTempDir() { try { return DefaultGroovyStaticMethods.createTempDir(null, "groovy-", "stubs"); } catch (IOException e) { throw new BuildException(e, getLocation()); } }
/** * 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 */ public static ResourceBundle getBundle(ResourceBundle self, String bundleName) { return getBundle(self,bundleName,Locale.getDefault()); }
/** * 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 */ public static Thread start(Thread self, String name, Closure closure) { return createThread(name, false, closure); }
/** * 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 */ public static void sleep(Object self, long milliseconds, Closure onInterrupt) { sleepImpl(milliseconds, onInterrupt); }
&& !configuration.getJointCompilationOptions().containsKey("stubDir")) tmpDir = DefaultGroovyStaticMethods.createTempDir(null, "groovy-generated-", "-java-source"); configuration.getJointCompilationOptions().put("stubDir", tmpDir);
/** * 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 */ public static Thread startDaemon(Thread self, Closure closure) { return createThread(null, true, closure); }
/** * 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 */ public static void sleep(Object self, long milliseconds, Closure onInterrupt) { sleepImpl(milliseconds, onInterrupt); }