Package org.jboss.logging.processor.util
Class Objects
java.lang.Object
org.jboss.logging.processor.util.Objects
Date: 30.08.2011
- Author:
- James R. Perkins
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA builder to simplify the building of hash codes.static classA builder to build a defaultObject#toString()value. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanareEqual(boolean first, boolean second) Checks to see if two booleans are equal.static booleanareEqual(char first, char second) Checks to see if two characters are equal.static booleanareEqual(double first, double second) Checks to see if two doubles are equal.static booleanareEqual(float first, float second) Checks to see if two floats are equal.static booleanareEqual(long first, long second) Checks to see if two longs are equal.static booleanChecks to see if two objects are equal.static <T> TcheckNonNull(T ref) Checks to see if an object isnull, otherwise throws anIllegalArgumentException.static <T> TcheckNonNull(T ref, String message) Checks to see if an object isnull, otherwise throws anIllegalArgumentException.static <T> TcheckNonNull(T ref, String message, Object... args) Checks to see if an object isnull, otherwise throws anIllegalArgumentException.
-
Method Details
-
areEqual
public static boolean areEqual(boolean first, boolean second) Checks to see if two booleans are equal.- Parameters:
first- the first boolean.second- the second boolean.- Returns:
trueif the first is equal to the second, otherwisefalse.
-
areEqual
public static boolean areEqual(char first, char second) Checks to see if two characters are equal.- Parameters:
first- the first character.second- the second character.- Returns:
trueif the first is equal to the second, otherwisefalse.
-
areEqual
public static boolean areEqual(long first, long second) Checks to see if two longs are equal. This method is also used for int's, shorts, and bytes.- Parameters:
first- the first long.second- the second long.- Returns:
trueif the first is equal to the second, otherwisefalse.
-
areEqual
public static boolean areEqual(float first, float second) Checks to see if two floats are equal.- Parameters:
first- the first float.second- the second float.- Returns:
trueif the first is equal to the second, otherwisefalse.
-
areEqual
public static boolean areEqual(double first, double second) Checks to see if two doubles are equal.- Parameters:
first- the first double.second- the second double.- Returns:
trueif the first is equal to the second, otherwisefalse.
-
areEqual
Checks to see if two objects are equal.Note this method does not handle arrays. The
Arraysclass has utilities for equality of arrays.- Parameters:
first- the first optionallynullobject.second- the second optionallynullobject.- Returns:
trueif the first is equal to the second, otherwisefalse.
-
checkNonNull
public static <T> T checkNonNull(T ref) Checks to see if an object isnull, otherwise throws anIllegalArgumentException.- Type Parameters:
T- the type of the object.- Parameters:
ref- the reference to the object.- Returns:
- the reference if it is not
null.
-
checkNonNull
Checks to see if an object isnull, otherwise throws anIllegalArgumentException.- Type Parameters:
T- the type of the object.- Parameters:
ref- the reference to the object.message- the message used in theIllegalArgumentExceptionconstructor.- Returns:
- the reference if it is not
null.
-
checkNonNull
Checks to see if an object isnull, otherwise throws anIllegalArgumentException.- Type Parameters:
T- the type of the object.- Parameters:
ref- the reference to the object.message- the message format used in theIllegalArgumentExceptionconstructor.args- the arguments used to format the message.- Returns:
- the reference if it is not
null.
-