Package org.jivesoftware.smack.util
Class Objects
- java.lang.Object
-
- org.jivesoftware.smack.util.Objects
-
-
Constructor Summary
Constructors Constructor Description Objects()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanequals(Object a, Object b)static <T> TrequireNonNull(T obj)static <T> TrequireNonNull(T obj, String message)Checks that the specified object reference is notnulland throws a customizedIllegalArgumentExceptionif it is.static <T extends Collection<?>>
TrequireNonNullNorEmpty(T collection, String message)Require a collection to be neither null, nor empty.
-
-
-
Constructor Detail
-
Objects
public Objects()
-
-
Method Detail
-
requireNonNull
public static <T> T requireNonNull(T obj, String message) throws IllegalArgumentException
Checks that the specified object reference is notnulland throws a customizedIllegalArgumentExceptionif it is.Note that unlike
java.util.Objects, this method throws anIllegalArgumentExceptioninstead of anNullPointerException.- Type Parameters:
T- the type of the reference.- Parameters:
obj- the object reference to check for nullity.message- detail message to be used in the event that aIllegalArgumentExceptionis thrown.- Returns:
objif not null.- Throws:
IllegalArgumentException- in caseobjisnull.
-
requireNonNull
public static <T> T requireNonNull(T obj)
-
requireNonNullNorEmpty
public static <T extends Collection<?>> T requireNonNullNorEmpty(T collection, String message)
Require a collection to be neither null, nor empty.- Type Parameters:
T- Collection type- Parameters:
collection- collectionmessage- error message- Returns:
- collection TODO javadoc me please
-
-