Class Utility


  • public final class Utility
    extends java.lang.Object
    Utility class. Add globally referenced Utility methods here.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.time.format.DateTimeFormatter DATE  
      static java.time.format.DateTimeFormatter TIME  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void deleteFolderRecursively​(java.nio.file.Path p)  
      static java.lang.String formatHost​(java.lang.String host)  
      static java.lang.String humanReadableFormat​(java.time.Duration duration)
      Convert a duration into a format like this 5m1s.
      static java.util.Optional<java.lang.Integer> integer​(java.lang.String s)  
      static void killChildProcessTree()
      Kills everything attached to this process.
      static java.lang.String ordinal​(int i)  
      static void prepareFilesystemProject​(Project prj)  
      static void requireNonNull​(java.lang.Object... objects)  
      static java.lang.String toString​(java.lang.Object obj)  
      static <T> T uncheckCall​(java.util.concurrent.Callable<T> callable)
      Convert call with checked exception to unchecked exception.
      Useful in streams.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DATE

        public static final java.time.format.DateTimeFormatter DATE
      • TIME

        public static final java.time.format.DateTimeFormatter TIME
    • Method Detail

      • formatHost

        public static java.lang.String formatHost​(java.lang.String host)
      • toString

        public static java.lang.String toString​(java.lang.Object obj)
      • requireNonNull

        public static void requireNonNull​(java.lang.Object... objects)
      • integer

        public static java.util.Optional<java.lang.Integer> integer​(java.lang.String s)
      • ordinal

        public static java.lang.String ordinal​(int i)
      • prepareFilesystemProject

        public static void prepareFilesystemProject​(Project prj)
                                             throws java.lang.Exception
        Throws:
        java.lang.Exception
      • uncheckCall

        public static <T> T uncheckCall​(java.util.concurrent.Callable<T> callable)
        Convert call with checked exception to unchecked exception.
        Useful in streams.
        Type Parameters:
        T - type of call
        Parameters:
        callable - to convert
        Returns:
        callable result
      • humanReadableFormat

        public static java.lang.String humanReadableFormat​(java.time.Duration duration)
        Convert a duration into a format like this 5m1s.
        Parameters:
        duration - to convert
        Returns:
        human readable format
      • killChildProcessTree

        public static void killChildProcessTree()
        Kills everything attached to this process.
      • deleteFolderRecursively

        public static void deleteFolderRecursively​(java.nio.file.Path p)
                                            throws java.io.IOException
        Throws:
        java.io.IOException