|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.utexas.its.eis.tools.qwicap.util.Null
public final class Null
This class provides a set of static utility methods that perform common tasks associated with the handling of
null
values.
Method Summary | |
---|---|
static String |
fromEmptyString(String PotentiallyEmptyStr)
Returns null if passed an empty (zero-length) String (or null ), otherwise
it returns the same String object that was passed to it. |
static String |
fromNullString(String PotentiallyNullStr)
If the supplied string literally reads "null", in other words it consists of the characters 'n', 'u', 'l', 'l' and no others, the value null is returned. |
static String |
fromSomeString(String PotentiallyRepresentingNullStr,
String NullRepresentationStr)
If the PotentiallyRepresentingNullStr parameter is a string that matches the string supplied in the
NullRepresentationStr parameter, the value null is returned. |
static boolean |
orEmpty(String PotentiallyNullOrEmptyStr)
Returns true if passed null , or an empty (zero length) String object; returns
false otherwise. |
static boolean |
safeEquals(Object A,
Object B)
Safely compares two objects for equality, where one, both, or none of the objects may be null . |
static String |
toEmptyString(Object PotentiallyNullObject)
Returns an empty (zero-length) String if passed null , otherwise it returns the object
reference that was passed-in. |
static String |
toNullString(Object PotentiallyNullObject)
Returns a string reading "null", if the supplied object reference is null . |
static String |
toSomeString(Object PotentiallyNullObject,
String NullSubstituteString)
Returns the supplied NullSubstituteStr , if the object reference supplied in
PotentiallyNullObject is null . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static boolean orEmpty(String PotentiallyNullOrEmptyStr)
true
if passed null
, or an empty (zero length) String
object; returns
false
otherwise.
PotentiallyNullOrEmptyStr
- null
or a String
object.
true
if passed null
, or an empty (zero length)
String
object; returns false
otherwise.public static String fromEmptyString(String PotentiallyEmptyStr)
null
if passed an empty (zero-length) String
(or null
), otherwise
it returns the same String
object that was passed to it.
PotentiallyEmptyStr
- A String
that may be empty, non-empty, or null
.
null
if the String
was empty or null
, otherwise
the String
object that was passed-in.public static String fromNullString(String PotentiallyNullStr)
null
is returned. Otherwise, the supplied string is returned.
PotentiallyNullStr
- Any String
object, or null
.
null
if the characters in the string spell the word "null", otherwise the
value passed-in as PotentiallyNullStr
is returned.public static String fromSomeString(String PotentiallyRepresentingNullStr, String NullRepresentationStr)
PotentiallyRepresentingNullStr
parameter is a string that matches the string supplied in the
NullRepresentationStr
parameter, the value null
is returned. Otherwise, the value of the
PotentiallyRepresentingNullStr
parameter is returned.
PotentiallyRepresentingNullStr
- Any String
object, or null
.NullRepresentationStr
- The string that should be considered to represent a null value.
null
, or the value passed-in as
PotentiallyRepresentingNullStr
.public static String toEmptyString(Object PotentiallyNullObject)
String
if passed null
, otherwise it returns the object
reference that was passed-in.
PotentiallyNullObject
- Any object reference, or null
.
String
if this method was passed null
,
otherwise the object reference that was passed-in.public static String toNullString(Object PotentiallyNullObject)
null
. Otherwise, the supplied
object is converted to a String
by invoking its Object.toString()
method, and that
String
is returned.
PotentiallyNullObject
- Any object reference, or null
.
String
object containing the word "null", or the String
returned by invoking PotentiallyNullObject.toString()
.public static String toSomeString(Object PotentiallyNullObject, String NullSubstituteString)
NullSubstituteStr
, if the object reference supplied in
PotentiallyNullObject
is null
. Otherwise, PotentiallyNullObject
is converted to a String
by invoking its Object.toString()
method, and that
String
is returned.
PotentiallyNullObject
- Any object reference, or null
.NullSubstituteString
- The String
to returned when PotentiallyNullObject
is
null
.
String
object passed-in as the PotentiallyNullObject
parameter, or the String
returned by invoking
PotentiallyNullObject.toString()
.public static boolean safeEquals(Object A, Object B)
null
.
A
- The first object to be used in the comparison. May be null
.B
- The second object to be used in the comparison. May be null
.
true
if the parameters are equal, either by reference or value, otherwise false
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |