|
dLife Home Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdlife.sys.Utility
public class Utility
A catch-all class for some small utility functions that are used throughout the dlife package.
| Constructor Summary | |
|---|---|
Utility()
|
|
| Method Summary | |
|---|---|
static void |
beep()
Emit a standard beep. |
static Object |
invokeMethod(Object obj,
String name,
Class<?>[] argTypes,
Object[] args)
Invoke the specified private/protected/package method on the specified object with the specified arguments. |
static int |
roundHalfUp(double val)
Round the provided double value to the nearest integer according to the HALF_UP rounding mode as described by the RoundingMode enum. |
static boolean |
runningInTest()
This method returns true if a junit test is running and false otherwise. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Utility()
| Method Detail |
|---|
public static boolean runningInTest()
public static int roundHalfUp(double val)
-1.1 -> -1 +1.1 -> +1 -1.7 -> -2 +1.7 -> +2
Note that to reduce overhead this method does not actually use the HALF_UP RoudingMode, which would require the creation of a BigDecimal. Rather it just rounds using the same rules as HALF_UP.
val - the value to be rounded.
public static void beep()
public static Object invokeMethod(Object obj,
String name,
Class<?>[] argTypes,
Object[] args)
|
dLife Home Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||