java.lang.Objectorg.apache.commons.lang.ObjectUtils
Operations on Object
.
This class tries to handle null
input gracefully.
An exception will generally not be thrown for a null
input.
Each method documents its behaviour in more detail.
Apache
- Software Foundation - href="mailto:nissim@nksystems.com">Nissim Karpenstein
- href="mailto:janekdb@yahoo.co.uk">Janek Bogucki
Daniel
- L. RallGary
- GregoryMario
- Winterer - href="mailto:david@davidkarlsen.com">David J. M. Karlsen
1.0
- $
- Id: ObjectUtils.java 905636 2010-02-02 14:03:32Z niallp $Nested Class Summary: | ||
---|---|---|
public static class | ObjectUtils.Null | Class used as a null placeholder where For example, in a Another example is |
Field Summary | ||
---|---|---|
public static final Null | NULL | Singleton used as a For example, in a Another example is This instance is Serializable. |
Constructor: |
---|
This constructor is public to permit tools that require a JavaBean instance to operate. |
Method from org.apache.commons.lang.ObjectUtils Summary: |
---|
appendIdentityToString, defaultIfNull, equals, hashCode, identityToString, identityToString, max, min, toString, toString |
Methods from java.lang.Object: |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method from org.apache.commons.lang.ObjectUtils Detail: |
---|
Deprecated! The - design of this method is bad - see LANG-360. Instead, use identityToString(StringBuffer, Object).Appends the toString that would be produced by ObjectUtils.appendIdentityToString(*, null) = null ObjectUtils.appendIdentityToString(null, "") = "java.lang.String@1e23" ObjectUtils.appendIdentityToString(null, Boolean.TRUE) = "java.lang.Boolean@7fa" ObjectUtils.appendIdentityToString(buf, Boolean.TRUE) = buf.append("java.lang.Boolean@7fa") |
Returns a default value if the object passed is
ObjectUtils.defaultIfNull(null, null) = null ObjectUtils.defaultIfNull(null, "") = "" ObjectUtils.defaultIfNull(null, "zz") = "zz" ObjectUtils.defaultIfNull("abc", *) = "abc" ObjectUtils.defaultIfNull(Boolean.TRUE, *) = Boolean.TRUE |
Compares two objects for equality, where either one or both
objects may be 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 |
Gets the hash code of an object returning zero when the
object is ObjectUtils.hashCode(null) = 0 ObjectUtils.hashCode(obj) = obj.hashCode() |
Gets the toString that would be produced by ObjectUtils.identityToString(null) = null ObjectUtils.identityToString("") = "java.lang.String@1e23" ObjectUtils.identityToString(Boolean.TRUE) = "java.lang.Boolean@7fa" |
Appends the toString that would be produced by ObjectUtils.identityToString(buf, "") = buf.append("java.lang.String@1e23" ObjectUtils.identityToString(buf, Boolean.TRUE) = buf.append("java.lang.Boolean@7fa" ObjectUtils.identityToString(buf, Boolean.TRUE) = buf.append("java.lang.Boolean@7fa") |
|
|
Gets the ObjectUtils.toString(null) = "" ObjectUtils.toString("") = "" ObjectUtils.toString("bat") = "bat" ObjectUtils.toString(Boolean.TRUE) = "true" |
Gets the ObjectUtils.toString(null, null) = null ObjectUtils.toString(null, "null") = "null" ObjectUtils.toString("", "null") = "" ObjectUtils.toString("bat", "null") = "bat" ObjectUtils.toString(Boolean.TRUE, "null") = "true" |