Package org.jivesoftware.smack.util
Class Objects
- java.lang.Object
-
- org.jivesoftware.smack.util.Objects
-
public class Objects extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Objects()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanequals(java.lang.Object a, java.lang.Object b)static <T> TrequireNonNull(T obj)static <T> TrequireNonNull(T obj, java.lang.String message)Checks that the specified object reference is notnulland throws a customizedIllegalArgumentExceptionif it is.static <T extends java.util.Collection<?>>
TrequireNonNullNorEmpty(T collection, java.lang.String message)Require a collection to be neither null, nor empty.
-
-
-
Method Detail
-
requireNonNull
public static <T> T requireNonNull(T obj, java.lang.String message) throws java.lang.IllegalArgumentExceptionChecks 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:
java.lang.IllegalArgumentException- in caseobjisnull.
-
requireNonNull
public static <T> T requireNonNull(T obj)
-
requireNonNullNorEmpty
public static <T extends java.util.Collection<?>> T requireNonNullNorEmpty(T collection, java.lang.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
-
equals
public static boolean equals(java.lang.Object a, java.lang.Object b)
-
-