|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.commons.lang.ObjectUtils
Common Object
manipulation routines.
Nested Class Summary | |
static class |
ObjectUtils.Null
Class used as a null placeholder where null has another meaning. |
Field Summary | |
static ObjectUtils.Null |
NULL
Singleton used as a null placeholder where null has another meaning. |
Constructor Summary | |
ObjectUtils()
ObjectUtils instances should NOT be constructed in standard programming. |
Method Summary | |
static Object |
defaultIfNull(Object object,
Object defaultValue)
Returns a default value if the object passed is null. |
static boolean |
equals(Object object1,
Object object2)
Compares two objects for equality, where either one or both objects may be null . |
static String |
identityToString(Object object)
Gets the toString that would be produced by Object if a class did not override toString itself. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final ObjectUtils.Null NULL
For example, in a HashMap
the get(key) method returns null
if the Map contains null or if there is no matching key. The Null
placeholder can be used to distinguish between these two cases.
Another example is HashTable
, where null
cannot be stored.
This instance is Serializable.
Constructor Detail |
public ObjectUtils()
ObjectUtils.defaultIfNull("a","b");
.
This constructor is public to permit tools that require a JavaBean instance
to operate.
Method Detail |
public static Object defaultIfNull(Object object, Object defaultValue)
object
- the object to testdefaultValue
- the default value to return
public static boolean equals(Object object1, Object object2)
null
.
object1
- the first objectobject2
- the second object
true
if the values of both objects are the samepublic static String identityToString(Object object)
object
- the object to create a toString for, may be null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |