|
Smack | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jivesoftware.smackx.workgroup.util.ModelUtil
public final class ModelUtil
Utility methods frequently used by data classes and design-time classes.
Method Summary | |
---|---|
static boolean |
areBooleansDifferent(Boolean b1,
Boolean b2)
This is a utility method that compares two Booleans when one or both of the objects might be null The result of
this method is determined as follows:
If b1 and b2 are both TRUE or
neither b1 nor b2 is TRUE,
return false . |
static boolean |
areBooleansEqual(Boolean b1,
Boolean b2)
This is a utility method that compares two Booleans when one or both of the objects might be null The result of
this method is determined as follows:
If b1 and b2 are both TRUE or
neither b1 nor b2 is TRUE,
return true . |
static boolean |
areDifferent(Object o1,
Object o2)
This is a utility method that compares two objects when one or both of the objects might be null . |
static boolean |
areEqual(Object o1,
Object o2)
This is a utility method that compares two objects when one or both of the objects might be null The result of
this method is determined as follows:
If o1 and o2 are the same object
according to the == operator, return
true . |
static String |
concat(String[] strs)
Returns a single string that is the concatenation of all the strings in the specified string array. |
static String |
concat(String[] strs,
String delim)
Returns a single string that is the concatenation of all the strings in the specified string array. |
static String |
getTimeFromLong(long diff)
|
static boolean |
hasLength(String s)
Returns true if the specified String is not
null and has a length greater than zero. |
static boolean |
hasNonNullElement(Object[] array)
Returns true if the specified array is not null
and contains a non-null element. |
static boolean |
hasStringChanged(String oldString,
String newString)
Determines if a string has been changed. |
static List |
iteratorAsList(Iterator i)
Build a List of all elements in an Iterator. |
static String |
nullifyIfEmpty(String s)
Returns null if the specified string is empty or
null . |
static String |
nullifyingToString(Object o)
Returns null if the specified object is null
or if its toString() representation is empty. |
static Iterator |
reverseListIterator(ListIterator i)
Creates an Iterator that is the reverse of a ListIterator. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static final boolean areEqual(Object o1, Object o2)
null
The result of
this method is determined as follows:
o1
and o2
are the same object
according to the ==
operator, return
true
.
o1
or o2
is
null
, return false
.
o1.equals(o2)
.
This method produces the exact logically inverted result as the
areDifferent(Object, Object)
method.
For array types, one of the equals
methods in
Arrays
should be used instead of this method.
Note that arrays with more than one dimension will require some
custom code in order to implement equals
properly.
public static final boolean areBooleansEqual(Boolean b1, Boolean b2)
null
The result of
this method is determined as follows:
b1
and b2
are both TRUE or
neither b1
nor b2
is TRUE,
return true
.
false
.
public static final boolean areDifferent(Object o1, Object o2)
null
. The result
returned by this method is determined as follows:
o1
and o2
are the same object
according to the ==
operator, return
false
.
o1
or o2
is
null
, return true
.
!o1.equals(o2)
.
This method produces the exact logically inverted result as the
areEqual(Object, Object)
method.
For array types, one of the equals
methods in
Arrays
should be used instead of this method.
Note that arrays with more than one dimension will require some
custom code in order to implement equals
properly.
public static final boolean areBooleansDifferent(Boolean b1, Boolean b2)
null
The result of
this method is determined as follows:
b1
and b2
are both TRUE or
neither b1
nor b2
is TRUE,
return false
.
true
.
This method produces the exact logically inverted result as the
areBooleansEqual(Boolean, Boolean)
method.
public static final boolean hasNonNullElement(Object[] array)
true
if the specified array is not null
and contains a non-null element. Returns false
if the array is null or if all the array elements are null.
public static final String concat(String[] strs)
public static final String concat(String[] strs, String delim)
public static final boolean hasLength(String s)
true
if the specified String
is not
null
and has a length greater than zero. This is
a very frequently occurring check.
public static final String nullifyIfEmpty(String s)
null
if the specified string is empty or
null
. Otherwise the string itself is returned.
public static final String nullifyingToString(Object o)
null
if the specified object is null
or if its toString()
representation is empty.
Otherwise, the toString()
representation of the
object itself is returned.
public static boolean hasStringChanged(String oldString, String newString)
oldString
- is the initial value of the StringnewString
- is the new value of the String
public static String getTimeFromLong(long diff)
public static List iteratorAsList(Iterator i)
public static Iterator reverseListIterator(ListIterator i)
|
Smack | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |