public class Util extends Object
Constructor and Description |
---|
Util() |
Modifier and Type | Method and Description |
---|---|
static long |
currentTimeMillis()
Gets the application time in milliseconds.
|
static boolean |
dynamicCodeAllowed()
Deprecated.
Please consider Kernel & Features specification instead.
|
static boolean |
isInInitialization()
Indicates whether the current code is part of the initialization phase.
|
static boolean |
isInMission()
Indicates whether the system has entered the mission phase, i.e.
|
static <T> T[] |
newArray(Class<T[]> type,
int length)
Allocates a new array of object references from the given array type and
length.
|
static long |
platformTimeMillis()
Gets an arbitrary time in milliseconds.
|
static long |
platformTimeNanos()
Gets an arbitrary time in nanoseconds.
|
static void |
setCurrentTimeMillis(Date d)
Sets the application time.
|
static void |
setCurrentTimeMillis(long t)
Sets the application time.
|
static void |
throwExceptionInThread(RuntimeException e,
Thread t)
Deprecated.
Please consider Kernel & Features specification instead.
|
static void |
throwHardExceptionInThread(RuntimeException e,
Thread t)
Deprecated.
Please consider Kernel & Features specification instead.
|
public static boolean isInMission()
true
if the initialization is doneImmortals
public static boolean isInInitialization()
When Class.forName(String)
triggers classes to be loaded at
runtime dynamically, class initializations are done in a context where
isInInitialization()
is true
and isInMission()
is
true
.
true
if the initialization is ongoingImmortals
@Deprecated public static boolean dynamicCodeAllowed()
Class.forName(String)
true
if the system allows dynamic code to be loaded,
false
otherwise@Deprecated public static void throwExceptionInThread(RuntimeException e, Thread t)
throwExceptionInThread(RuntimeException, Thread)
or
throwHardExceptionInThread(RuntimeException, Thread)
is already
pending for the thread, nothing is done.
If any of the arguments is null
, an
IllegalArgumentException
is thrown.
e
- the exception to throwt
- the thread in which the exception is thrownIllegalArgumentException
- if any of the arguments is null
.@Deprecated public static void throwHardExceptionInThread(RuntimeException e, Thread t)
throwHardExceptionInThread(RuntimeException, Thread)
is already
pending for the thread, nothing is done.throwExceptionInThread(RuntimeException, Thread)
is already pending
for the thread, this exception is replaced by the given exception.e
- the exception to throwt
- the thread in which the exception is thrownIllegalArgumentException
- if any of the arguments is null
.public static long currentTimeMillis()
The result of this method is the same as the
System.currentTimeMillis()
method one.
public static long platformTimeMillis()
Only elapsed time between two calls is meaningful.
public static long platformTimeNanos()
Only elapsed time between two calls is meaningful.
public static void setCurrentTimeMillis(long t)
This time does not change the platform time.
t
- the application time to set in millisecondsIllegalArgumentException
- if t
is negativepublic static void setCurrentTimeMillis(Date d)
This time does not change the platform time. The
Util.setCurrentTimeMillis(d)
method has the same effect as
Util.setCurrentTimeMillis(d.getTime())
.
d
- the application time to setpublic static <T> T[] newArray(Class<T[]> type, int length)
T
- the type of the array elementstype
- the type of the array to allocatelength
- the length of the array to allocateNullPointerException
- if the type is null
OutOfMemoryError
- if the array could not be allocated