Package ej.bon

Class Util


  • public class Util
    extends Object
    This class offers basic services for B-ON implementation.
    • Constructor Detail

      • Util

        public Util()
    • Method Detail

      • currentTimeMillis

        public static long currentTimeMillis()
        Gets the application time in milliseconds.

        The result of this method is the same as the System.currentTimeMillis() method one.

        Returns:
        the application time in milliseconds
      • platformTimeMillis

        public static long platformTimeMillis()
        Gets an arbitrary time in milliseconds.

        Only elapsed time between two calls is meaningful.

        Returns:
        the platform time in milliseconds
      • platformTimeNanos

        public static long platformTimeNanos()
        Gets an arbitrary time in nanoseconds.

        Only elapsed time between two calls is meaningful.

        Returns:
        the platform time in nanoseconds
      • setCurrentTimeMillis

        public static void setCurrentTimeMillis​(long t)
        Sets the application time.

        This time does not change the platform time.

        Parameters:
        t - the application time to set in milliseconds
        Throws:
        IllegalArgumentException - if t is negative
      • setCurrentTimeMillis

        public static void setCurrentTimeMillis​(Date d)
        Sets the application time.

        This time does not change the platform time. The Util.setCurrentTimeMillis(d) method has the same effect as Util.setCurrentTimeMillis(d.getTime()).

        Parameters:
        d - the application time to set
      • newArray

        public static <T> T[] newArray​(Class<T[]> type,
                                       int length)
        Allocates a new array of object references from the given array type and length.
        Type Parameters:
        T - the type of the array elements
        Parameters:
        type - the type of the array to allocate
        length - the length of the array to allocate
        Returns:
        the new allocated array
        Throws:
        NullPointerException - if the type is null
        OutOfMemoryError - if the array could not be allocated