|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectinfo.javelot.functionalj.util.Utils
public final class Utils
Contains general utility methods.
| Method Summary | |
|---|---|
static void |
disallowNull(Object p_parameter,
String p_name)
Verifies if the parameter is null, and throws an exception if it
is. |
static int |
getInt(Object p_object)
Returns an int from an Object, using the numerical value of its
String representation. |
static int |
safeCompare(Comparable p_first,
Comparable p_second)
Returns the result of comparing two objects, by considering two null values to be equal, a null to come after a
non-null value, and by using the compareTo() method
to compare two non-null values. |
static boolean |
safeEqualArrays(Object[] p_first,
Object[] p_second)
Verifies if two arrays of objects are equal, considering null
values to be equal, and comparing corresponding elements of each array. |
static boolean |
safeEquals(Object p_first,
Object p_second)
Verifies if two objects are equal, by considering two null values
to be equal, a null and non-null value not to be
equal, and by using the equals() method to compare two
non-null values. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static void disallowNull(Object p_parameter,
String p_name)
throws FunctionException
null, and throws an exception if it
is. Does nothing if the parameter is not null.
p_parameter - the parameter that is checked for null.p_name - the name of the parameter. This name will be
displayed as part of the message of the FunctionException, if thrown, as
follows: "The {name} parameter cannot be null."
FunctionException - thrown if the parameter is null.
public static boolean safeEquals(Object p_first,
Object p_second)
null values
to be equal, a null and non-null value not to be
equal, and by using the equals() method to compare two
non-null values.
p_first - the first object to consider for equality.p_second - the second object to consider for equality.
true if the two objects are considered equal,
false otherwise.
public static boolean safeEqualArrays(Object[] p_first,
Object[] p_second)
null
values to be equal, and comparing corresponding elements of each array.
p_first - the first array to consider for equality.p_second - the second array to consider for equality.
true if the two arrays are considered equal,
false otherwise.
public static int safeCompare(Comparable p_first,
Comparable p_second)
null values to be equal, a null to come after a
non-null value, and by using the compareTo() method
to compare two non-null values.
p_first - the first object to consider for comparison.p_second - the second object to consider for comparison.
public static int getInt(Object p_object)
int from an Object, using the numerical value of its
String representation.
p_object - the object to be converted to an int.
int value of the Object.
NumberFormatException - thrown if the Object's String representation
is not a valid integer value.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||