Java org.apache.commons.lang ObjectUtils fields, constructors, methods, implement or subclass

Example usage for Java org.apache.commons.lang ObjectUtils fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for org.apache.commons.lang ObjectUtils.

The text is from its open source code.

Subclass

org.apache.commons.lang.ObjectUtils has subclasses.
Click this link to see all its subclasses.

Field

NullNULL

Singleton used as a null placeholder where null has another meaning.

For example, in a HashMap the java.util.HashMap#get(java.lang.Object) method returns null if the Map contains null or if there is no matching key.

Method

intcompare(T c1, T c2)
Null safe comparison of Comparables.
intcompare(T c1, T c2, boolean nullGreater)
Null safe comparison of Comparables.
TdefaultIfNull(T object, T defaultValue)

Returns a default value if the object passed is null.

 ObjectUtils.defaultIfNull(null, null)      = null ObjectUtils.defaultIfNull(null, "")        = "" ObjectUtils.defaultIfNull(null, "zz")      = "zz" ObjectUtils.defaultIfNull("abc", *)        = "abc" ObjectUtils.defaultIfNull(Boolean.TRUE, *) = Boolean.TRUE 
booleanequals(Object object1, Object object2)

Compares two objects for equality, where either one or both objects may be null.

 ObjectUtils.equals(null, null)                  = true ObjectUtils.equals(null, "")                    = false ObjectUtils.equals("", null)                    = false ObjectUtils.equals("", "")                      = true ObjectUtils.equals(Boolean.TRUE, null)          = false ObjectUtils.equals(Boolean.TRUE, "true")        = false ObjectUtils.equals(Boolean.TRUE, Boolean.TRUE)  = true ObjectUtils.equals(Boolean.TRUE, Boolean.FALSE) = false 
inthashCode(Object obj)

Gets the hash code of an object returning zero when the object is null.

 ObjectUtils.hashCode(null)   = 0 ObjectUtils.hashCode(obj)    = obj.hashCode() 
StringidentityToString(Object object)

Gets the toString that would be produced by Object if a class did not override toString itself.

voididentityToString(StringBuffer buffer, Object object)

Appends the toString that would be produced by Object if a class did not override toString itself.

booleannotEqual(Object object1, Object object2)

Compares two objects for inequality, where either one or both objects may be null.

 ObjectUtils.notEqual(null, null)                  = false ObjectUtils.notEqual(null, "")                    = true ObjectUtils.notEqual("", null)                    = true ObjectUtils.notEqual("", "")                      = false ObjectUtils.notEqual(Boolean.TRUE, null)          = true ObjectUtils.notEqual(Boolean.TRUE, "true")        = true ObjectUtils.notEqual(Boolean.TRUE, Boolean.TRUE)  = false ObjectUtils.notEqual(Boolean.TRUE, Boolean.FALSE) = true 
StringtoString(Object obj)

Gets the toString of an Object returning an empty string ("") if null input.

 ObjectUtils.toString(null)         = "" ObjectUtils.toString("")           = "" ObjectUtils.toString("bat")        = "bat" ObjectUtils.toString(Boolean.TRUE) = "true" 
StringtoString(Object obj, String nullStr)

Gets the toString of an Object returning a specified text if null input.

 ObjectUtils.toString(null, null)           = null ObjectUtils.toString(null, "null")         = "null" ObjectUtils.toString("", "null")           = "" ObjectUtils.toString("bat", "null")        = "bat" ObjectUtils.toString(Boolean.TRUE, "null") = "true" 
StringtoString()
Returns a string representation of the object.