Package 

Class HelpersKt

    • Method Detail

      • println

         final static <T extends Any> T println(T $self, String prefix)

        Print receiver to stdout. Convenient utility to debug variables quickly.

        Parameters:
        prefix - String to print before the actual object information.
      • freePort

         final static Integer freePort()

        Return a random free port (not used by any other local process).

      • isPortOpened

         final static Boolean isPortOpened(Integer port)

        Check if a port is already opened.

        Parameters:
        port - Port number to check.
      • retry

         final static <T extends Any> T retry(Integer times, Long delay, Function0<T> block)

        Execute a lambda until no exception is thrown or a number of times is reached.

        Parameters:
        times - Number of times to try to execute the callback.
        delay - Milliseconds to wait to next execution if there was an error.
        block - Code to be executed.
      • exec

         final static String exec(List<String> $self, File workingDirectory, Long timeout, Boolean fail)

        TODO.

        TODO Assure JVM closes properly after process execution (dispose process resources, etc.)

      • exec

         final static String exec(String $self, File workingDirectory, Long timeout, Boolean fail)

        TODO Add use case and example in documentation. TODO Support multiple words parameters by processing " and '

        Run the receiver's text as a process in the host operating system. The command can have multiple lines and may or may not contain the shell continuation string (\\n).

        Parameters:
        workingDirectory - Directory on which the process will be executed.
        timeout - Maximum number of seconds allowed for process execution.
        fail - If true Raise an exception if the result code is different than zero.
      • filterStackTrace

         final static Array<out StackTraceElement> filterStackTrace(Throwable $self, String prefix)

        Return the stack trace array of the frames that starts with the given prefix.

        Parameters:
        prefix - Prefix used to filter stack trace elements (applied to class names).
      • toText

         final static String toText(Throwable $self, String prefix)

        Return this throwable as a text.

        Parameters:
        prefix - Optional prefix to filter stack trace elements.
      • require

         final static <K extends Any, V extends Any> V require(Map<K, V> $self, K name)
        Parameters:
        name - .