Package ej.bon
Class Util
- java.lang.Object
-
- ej.bon.Util
-
public class Util extends Object
This class offers basic services for B-ON implementation.
-
-
Constructor Summary
Constructors Constructor Description Util()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static longcurrentTimeMillis()Gets the application time in milliseconds.static <T> T[]newArray(Class<T[]> type, int length)Allocates a new array of object references from the given array type and length.static longplatformTimeMillis()Gets an arbitrary time in milliseconds.static longplatformTimeNanos()Gets an arbitrary time in nanoseconds.static voidsetCurrentTimeMillis(long t)Sets the application time.static voidsetCurrentTimeMillis(Date d)Sets the application time.
-
-
-
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- iftis 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 asUtil.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 allocatelength- the length of the array to allocate- Returns:
- the new allocated array
- Throws:
NullPointerException- if the type isnullOutOfMemoryError- if the array could not be allocated
-
-