1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
5 <!-- Generated by javadoc (build 1.4.2_16) on Sat Mar 15 20:43:47 PDT 2008 -->
6 <META http-equiv=
"Content-Type" content=
"text/html; charset=ISO-8859-1">
8 ObjectUtils (Commons Lang
2.4 API)
11 <META NAME=
"keywords" CONTENT=
"org.apache.commons.lang.ObjectUtils class">
13 <LINK REL =
"stylesheet" TYPE=
"text/css" HREF=
"../../../../stylesheet.css" TITLE=
"Style">
15 <SCRIPT type=
"text/javascript">
16 function windowTitle()
18 parent.document.
title=
"ObjectUtils (Commons Lang 2.4 API)";
24 <BODY BGCOLOR=
"white" onload=
"windowTitle();">
27 <!-- ========= START OF TOP NAVBAR ======= -->
28 <A NAME=
"navbar_top"><!-- --></A>
29 <A HREF=
"#skip-navbar_top" title=
"Skip navigation links"></A>
30 <TABLE BORDER=
"0" WIDTH=
"100%" CELLPADDING=
"1" CELLSPACING=
"0" SUMMARY=
"">
32 <TD COLSPAN=
3 BGCOLOR=
"#EEEEFF" CLASS=
"NavBarCell1">
33 <A NAME=
"navbar_top_firstrow"><!-- --></A>
34 <TABLE BORDER=
"0" CELLPADDING=
"0" CELLSPACING=
"3" SUMMARY=
"">
35 <TR ALIGN=
"center" VALIGN=
"top">
36 <TD BGCOLOR=
"#EEEEFF" CLASS=
"NavBarCell1"> <A HREF=
"../../../../overview-summary.html"><FONT CLASS=
"NavBarFont1"><B>Overview
</B></FONT></A> </TD>
37 <TD BGCOLOR=
"#EEEEFF" CLASS=
"NavBarCell1"> <A HREF=
"package-summary.html"><FONT CLASS=
"NavBarFont1"><B>Package
</B></FONT></A> </TD>
38 <TD BGCOLOR=
"#FFFFFF" CLASS=
"NavBarCell1Rev"> <FONT CLASS=
"NavBarFont1Rev"><B>Class
</B></FONT> </TD>
39 <TD BGCOLOR=
"#EEEEFF" CLASS=
"NavBarCell1"> <A HREF=
"class-use/ObjectUtils.html"><FONT CLASS=
"NavBarFont1"><B>Use
</B></FONT></A> </TD>
40 <TD BGCOLOR=
"#EEEEFF" CLASS=
"NavBarCell1"> <A HREF=
"package-tree.html"><FONT CLASS=
"NavBarFont1"><B>Tree
</B></FONT></A> </TD>
41 <TD BGCOLOR=
"#EEEEFF" CLASS=
"NavBarCell1"> <A HREF=
"../../../../deprecated-list.html"><FONT CLASS=
"NavBarFont1"><B>Deprecated
</B></FONT></A> </TD>
42 <TD BGCOLOR=
"#EEEEFF" CLASS=
"NavBarCell1"> <A HREF=
"../../../../index-all.html"><FONT CLASS=
"NavBarFont1"><B>Index
</B></FONT></A> </TD>
43 <TD BGCOLOR=
"#EEEEFF" CLASS=
"NavBarCell1"> <A HREF=
"../../../../help-doc.html"><FONT CLASS=
"NavBarFont1"><B>Help
</B></FONT></A> </TD>
47 <TD ALIGN=
"right" VALIGN=
"top" ROWSPAN=
3><EM>
53 <TD BGCOLOR=
"white" CLASS=
"NavBarCell2"><FONT SIZE=
"-2">
54 <A HREF=
"../../../../org/apache/commons/lang/NumberUtils.html" title=
"class in org.apache.commons.lang"><B>PREV CLASS
</B></A>
55 <A HREF=
"../../../../org/apache/commons/lang/ObjectUtils.Null.html" title=
"class in org.apache.commons.lang"><B>NEXT CLASS
</B></A></FONT></TD>
56 <TD BGCOLOR=
"white" CLASS=
"NavBarCell2"><FONT SIZE=
"-2">
57 <A HREF=
"../../../../index.html" target=
"_top"><B>FRAMES
</B></A>
58 <A HREF=
"ObjectUtils.html" target=
"_top"><B>NO FRAMES
</B></A>
59 <SCRIPT type=
"text/javascript">
62 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
67 <A HREF=
"../../../../allclasses-noframe.html"><B>All Classes
</B></A>
73 <TD VALIGN=
"top" CLASS=
"NavBarCell3"><FONT SIZE=
"-2">
74 SUMMARY:
<A HREF=
"#nested_class_summary">NESTED
</A> |
<A HREF=
"#field_summary">FIELD
</A> |
<A HREF=
"#constructor_summary">CONSTR
</A> |
<A HREF=
"#method_summary">METHOD
</A></FONT></TD>
75 <TD VALIGN=
"top" CLASS=
"NavBarCell3"><FONT SIZE=
"-2">
76 DETAIL:
<A HREF=
"#field_detail">FIELD
</A> |
<A HREF=
"#constructor_detail">CONSTR
</A> |
<A HREF=
"#method_detail">METHOD
</A></FONT></TD>
79 <A NAME=
"skip-navbar_top"></A>
80 <!-- ========= END OF TOP NAVBAR ========= -->
83 <!-- ======== START OF CLASS DATA ======== -->
86 org.apache.commons.lang
</FONT>
88 Class ObjectUtils
</H2>
91 <IMG SRC=
"../../../../resources/inherit.gif" ALT=
"extended by"><B>org.apache.commons.lang.ObjectUtils
</B>
95 <DT>public class
<B>ObjectUtils
</B><DT>extends java.lang.Object
</DL>
98 <p>Operations on
<code>Object
</code>.
</p>
100 <p>This class tries to handle
<code>null
</code> input gracefully.
101 An exception will generally not be thrown for a
<code>null
</code> input.
102 Each method documents its behaviour in more detail.
</p>
107 <DT><B>Since:
</B></DT>
109 <DT><B>Version:
</B></DT>
110 <DD>$Id: ObjectUtils.java
594336 2007-
11-
12 22:
54:
02Z bayard $
</DD>
111 <DT><B>Author:
</B></DT>
112 <DD><a href=
"mailto:nissim@nksystems.com">Nissim Karpenstein
</a>,
<a href=
"mailto:janekdb@yahoo.co.uk">Janek Bogucki
</a>, Daniel L. Rall, Stephen Colebourne, Gary Gregory, Mario Winterer,
<a href=
"mailto:david@davidkarlsen.com">David J. M. Karlsen
</a></DD>
117 <!-- ======== NESTED CLASS SUMMARY ======== -->
119 <A NAME=
"nested_class_summary"><!-- --></A>
120 <TABLE BORDER=
"1" WIDTH=
"100%" CELLPADDING=
"3" CELLSPACING=
"0" SUMMARY=
"">
121 <TR BGCOLOR=
"#CCCCFF" CLASS=
"TableHeadingColor">
122 <TD COLSPAN=
2><FONT SIZE=
"+2">
123 <B>Nested Class Summary
</B></FONT></TD>
125 <TR BGCOLOR=
"white" CLASS=
"TableRowColor">
126 <TD ALIGN=
"right" VALIGN=
"top" WIDTH=
"1%"><FONT SIZE=
"-1">
127 <CODE>static
class
</CODE></FONT></TD>
128 <TD><CODE><B><A HREF=
"../../../../org/apache/commons/lang/ObjectUtils.Null.html" title=
"class in org.apache.commons.lang">ObjectUtils.Null
</A></B></CODE>
131 Class used as a null placeholder where
<code>null
</code>
132 has another meaning.
</TD>
136 <!-- =========== FIELD SUMMARY =========== -->
138 <A NAME=
"field_summary"><!-- --></A>
139 <TABLE BORDER=
"1" WIDTH=
"100%" CELLPADDING=
"3" CELLSPACING=
"0" SUMMARY=
"">
140 <TR BGCOLOR=
"#CCCCFF" CLASS=
"TableHeadingColor">
141 <TD COLSPAN=
2><FONT SIZE=
"+2">
142 <B>Field Summary
</B></FONT></TD>
144 <TR BGCOLOR=
"white" CLASS=
"TableRowColor">
145 <TD ALIGN=
"right" VALIGN=
"top" WIDTH=
"1%"><FONT SIZE=
"-1">
146 <CODE>static
<A HREF=
"../../../../org/apache/commons/lang/ObjectUtils.Null.html" title=
"class in org.apache.commons.lang">ObjectUtils.Null
</A></CODE></FONT></TD>
147 <TD><CODE><B><A HREF=
"../../../../org/apache/commons/lang/ObjectUtils.html#NULL">NULL
</A></B></CODE>
150 Singleton used as a
<code>null
</code> placeholder where
151 <code>null
</code> has another meaning.
</TD>
155 <!-- ======== CONSTRUCTOR SUMMARY ======== -->
157 <A NAME=
"constructor_summary"><!-- --></A>
158 <TABLE BORDER=
"1" WIDTH=
"100%" CELLPADDING=
"3" CELLSPACING=
"0" SUMMARY=
"">
159 <TR BGCOLOR=
"#CCCCFF" CLASS=
"TableHeadingColor">
160 <TD COLSPAN=
2><FONT SIZE=
"+2">
161 <B>Constructor Summary
</B></FONT></TD>
163 <TR BGCOLOR=
"white" CLASS=
"TableRowColor">
164 <TD><CODE><B><A HREF=
"../../../../org/apache/commons/lang/ObjectUtils.html#ObjectUtils()">ObjectUtils
</A></B>()
</CODE>
167 <code>ObjectUtils
</code> instances should NOT be constructed in
168 standard programming.
</TD>
172 <!-- ========== METHOD SUMMARY =========== -->
174 <A NAME=
"method_summary"><!-- --></A>
175 <TABLE BORDER=
"1" WIDTH=
"100%" CELLPADDING=
"3" CELLSPACING=
"0" SUMMARY=
"">
176 <TR BGCOLOR=
"#CCCCFF" CLASS=
"TableHeadingColor">
177 <TD COLSPAN=
2><FONT SIZE=
"+2">
178 <B>Method Summary
</B></FONT></TD>
180 <TR BGCOLOR=
"white" CLASS=
"TableRowColor">
181 <TD ALIGN=
"right" VALIGN=
"top" WIDTH=
"1%"><FONT SIZE=
"-1">
182 <CODE>static
java.lang.StringBuffer
</CODE></FONT></TD>
183 <TD><CODE><B><A HREF=
"../../../../org/apache/commons/lang/ObjectUtils.html#appendIdentityToString(java.lang.StringBuffer, java.lang.Object)">appendIdentityToString
</A></B>(java.lang.StringBuffer
buffer,
184 java.lang.Object
object)
</CODE>
187 <B>Deprecated.
</B> <I>The design of this method is bad - see LANG-
360. Instead, use identityToString(StringBuffer, Object).
</I></TD>
189 <TR BGCOLOR=
"white" CLASS=
"TableRowColor">
190 <TD ALIGN=
"right" VALIGN=
"top" WIDTH=
"1%"><FONT SIZE=
"-1">
191 <CODE>static
java.lang.Object
</CODE></FONT></TD>
192 <TD><CODE><B><A HREF=
"../../../../org/apache/commons/lang/ObjectUtils.html#defaultIfNull(java.lang.Object, java.lang.Object)">defaultIfNull
</A></B>(java.lang.Object
object,
193 java.lang.Object
defaultValue)
</CODE>
196 Returns a default value if the object passed is
197 <code>null
</code>.
</TD>
199 <TR BGCOLOR=
"white" CLASS=
"TableRowColor">
200 <TD ALIGN=
"right" VALIGN=
"top" WIDTH=
"1%"><FONT SIZE=
"-1">
201 <CODE>static
boolean
</CODE></FONT></TD>
202 <TD><CODE><B><A HREF=
"../../../../org/apache/commons/lang/ObjectUtils.html#equals(java.lang.Object, java.lang.Object)">equals
</A></B>(java.lang.Object
object1,
203 java.lang.Object
object2)
</CODE>
206 Compares two objects for equality, where either one or both
207 objects may be
<code>null
</code>.
</TD>
209 <TR BGCOLOR=
"white" CLASS=
"TableRowColor">
210 <TD ALIGN=
"right" VALIGN=
"top" WIDTH=
"1%"><FONT SIZE=
"-1">
211 <CODE>static
int
</CODE></FONT></TD>
212 <TD><CODE><B><A HREF=
"../../../../org/apache/commons/lang/ObjectUtils.html#hashCode(java.lang.Object)">hashCode
</A></B>(java.lang.Object
obj)
</CODE>
215 Gets the hash code of an object returning zero when the
216 object is
<code>null
</code>.
</TD>
218 <TR BGCOLOR=
"white" CLASS=
"TableRowColor">
219 <TD ALIGN=
"right" VALIGN=
"top" WIDTH=
"1%"><FONT SIZE=
"-1">
220 <CODE>static
java.lang.String
</CODE></FONT></TD>
221 <TD><CODE><B><A HREF=
"../../../../org/apache/commons/lang/ObjectUtils.html#identityToString(java.lang.Object)">identityToString
</A></B>(java.lang.Object
object)
</CODE>
224 Gets the toString that would be produced by
<code>Object
</code>
225 if a class did not override toString itself.
</TD>
227 <TR BGCOLOR=
"white" CLASS=
"TableRowColor">
228 <TD ALIGN=
"right" VALIGN=
"top" WIDTH=
"1%"><FONT SIZE=
"-1">
229 <CODE>static
void
</CODE></FONT></TD>
230 <TD><CODE><B><A HREF=
"../../../../org/apache/commons/lang/ObjectUtils.html#identityToString(java.lang.StringBuffer, java.lang.Object)">identityToString
</A></B>(java.lang.StringBuffer
buffer,
231 java.lang.Object
object)
</CODE>
234 Appends the toString that would be produced by
<code>Object
</code>
235 if a class did not override toString itself.
</TD>
237 <TR BGCOLOR=
"white" CLASS=
"TableRowColor">
238 <TD ALIGN=
"right" VALIGN=
"top" WIDTH=
"1%"><FONT SIZE=
"-1">
239 <CODE>static
java.lang.Object
</CODE></FONT></TD>
240 <TD><CODE><B><A HREF=
"../../../../org/apache/commons/lang/ObjectUtils.html#max(java.lang.Comparable, java.lang.Comparable)">max
</A></B>(java.lang.Comparable
c1,
241 java.lang.Comparable
c2)
</CODE>
244 Null safe comparison of Comparables.
</TD>
246 <TR BGCOLOR=
"white" CLASS=
"TableRowColor">
247 <TD ALIGN=
"right" VALIGN=
"top" WIDTH=
"1%"><FONT SIZE=
"-1">
248 <CODE>static
java.lang.Object
</CODE></FONT></TD>
249 <TD><CODE><B><A HREF=
"../../../../org/apache/commons/lang/ObjectUtils.html#min(java.lang.Comparable, java.lang.Comparable)">min
</A></B>(java.lang.Comparable
c1,
250 java.lang.Comparable
c2)
</CODE>
253 Null safe comparison of Comparables.
</TD>
255 <TR BGCOLOR=
"white" CLASS=
"TableRowColor">
256 <TD ALIGN=
"right" VALIGN=
"top" WIDTH=
"1%"><FONT SIZE=
"-1">
257 <CODE>static
java.lang.String
</CODE></FONT></TD>
258 <TD><CODE><B><A HREF=
"../../../../org/apache/commons/lang/ObjectUtils.html#toString(java.lang.Object)">toString
</A></B>(java.lang.Object
obj)
</CODE>
261 Gets the
<code>toString
</code> of an
<code>Object
</code> returning
262 an empty string (
"") if
<code>null
</code> input.
</TD>
264 <TR BGCOLOR=
"white" CLASS=
"TableRowColor">
265 <TD ALIGN=
"right" VALIGN=
"top" WIDTH=
"1%"><FONT SIZE=
"-1">
266 <CODE>static
java.lang.String
</CODE></FONT></TD>
267 <TD><CODE><B><A HREF=
"../../../../org/apache/commons/lang/ObjectUtils.html#toString(java.lang.Object, java.lang.String)">toString
</A></B>(java.lang.Object
obj,
268 java.lang.String
nullStr)
</CODE>
271 Gets the
<code>toString
</code> of an
<code>Object
</code> returning
272 a specified text if
<code>null
</code> input.
</TD>
275 <A NAME=
"methods_inherited_from_class_java.lang.Object"><!-- --></A>
276 <TABLE BORDER=
"1" WIDTH=
"100%" CELLPADDING=
"3" CELLSPACING=
"0" SUMMARY=
"">
277 <TR BGCOLOR=
"#EEEEFF" CLASS=
"TableSubHeadingColor">
278 <TD><B>Methods inherited from class java.lang.Object
</B></TD>
280 <TR BGCOLOR=
"white" CLASS=
"TableRowColor">
281 <TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
</CODE></TD>
287 <!-- ============ FIELD DETAIL =========== -->
289 <A NAME=
"field_detail"><!-- --></A>
290 <TABLE BORDER=
"1" WIDTH=
"100%" CELLPADDING=
"3" CELLSPACING=
"0" SUMMARY=
"">
291 <TR BGCOLOR=
"#CCCCFF" CLASS=
"TableHeadingColor">
292 <TD COLSPAN=
1><FONT SIZE=
"+2">
293 <B>Field Detail
</B></FONT></TD>
297 <A NAME=
"NULL"><!-- --></A><H3>
300 public static final
<A HREF=
"../../../../org/apache/commons/lang/ObjectUtils.Null.html" title=
"class in org.apache.commons.lang">ObjectUtils.Null
</A> <B>NULL
</B></PRE>
302 <DD><p>Singleton used as a
<code>null
</code> placeholder where
303 <code>null
</code> has another meaning.
</p>
305 <p>For example, in a
<code>HashMap
</code> the
306 <CODE>HashMap.get(java.lang.Object)
</CODE> method returns
307 <code>null
</code> if the
<code>Map
</code> contains
308 <code>null
</code> or if there is no matching key. The
309 <code>Null
</code> placeholder can be used to distinguish between
312 <p>Another example is
<code>Hashtable
</code>, where
<code>null
</code>
313 cannot be stored.
</p>
315 <p>This instance is Serializable.
</p>
321 <!-- ========= CONSTRUCTOR DETAIL ======== -->
323 <A NAME=
"constructor_detail"><!-- --></A>
324 <TABLE BORDER=
"1" WIDTH=
"100%" CELLPADDING=
"3" CELLSPACING=
"0" SUMMARY=
"">
325 <TR BGCOLOR=
"#CCCCFF" CLASS=
"TableHeadingColor">
326 <TD COLSPAN=
1><FONT SIZE=
"+2">
327 <B>Constructor Detail
</B></FONT></TD>
331 <A NAME=
"ObjectUtils()"><!-- --></A><H3>
334 public
<B>ObjectUtils
</B>()
</PRE>
336 <DD><p><code>ObjectUtils
</code> instances should NOT be constructed in
337 standard programming. Instead, the class should be used as
338 <code>ObjectUtils.defaultIfNull(
"a",
"b");
</code>.
</p>
340 <p>This constructor is public to permit tools that require a JavaBean instance
345 <!-- ============ METHOD DETAIL ========== -->
347 <A NAME=
"method_detail"><!-- --></A>
348 <TABLE BORDER=
"1" WIDTH=
"100%" CELLPADDING=
"3" CELLSPACING=
"0" SUMMARY=
"">
349 <TR BGCOLOR=
"#CCCCFF" CLASS=
"TableHeadingColor">
350 <TD COLSPAN=
1><FONT SIZE=
"+2">
351 <B>Method Detail
</B></FONT></TD>
355 <A NAME=
"defaultIfNull(java.lang.Object, java.lang.Object)"><!-- --></A><H3>
358 public static java.lang.Object
<B>defaultIfNull
</B>(java.lang.Object
object,
359 java.lang.Object
defaultValue)
</PRE>
361 <DD><p>Returns a default value if the object passed is
362 <code>null
</code>.
</p>
365 ObjectUtils.defaultIfNull(null, null) = null
366 ObjectUtils.defaultIfNull(null,
"") =
""
367 ObjectUtils.defaultIfNull(null,
"zz") =
"zz"
368 ObjectUtils.defaultIfNull(
"abc", *) =
"abc"
369 ObjectUtils.defaultIfNull(Boolean.TRUE, *) = Boolean.TRUE
373 <DT><B>Parameters:
</B><DD><CODE>object
</CODE> - the
<code>Object
</code> to test, may be
<code>null
</code><DD><CODE>defaultValue
</CODE> - the default value to return, may be
<code>null
</code>
374 <DT><B>Returns:
</B><DD><code>object
</code> if it is not
<code>null
</code>, defaultValue otherwise
</DL>
379 <A NAME=
"equals(java.lang.Object, java.lang.Object)"><!-- --></A><H3>
382 public static boolean
<B>equals
</B>(java.lang.Object
object1,
383 java.lang.Object
object2)
</PRE>
385 <DD><p>Compares two objects for equality, where either one or both
386 objects may be
<code>null
</code>.
</p>
389 ObjectUtils.equals(null, null) = true
390 ObjectUtils.equals(null,
"") = false
391 ObjectUtils.equals(
"", null) = false
392 ObjectUtils.equals(
"",
"") = true
393 ObjectUtils.equals(Boolean.TRUE, null) = false
394 ObjectUtils.equals(Boolean.TRUE,
"true") = false
395 ObjectUtils.equals(Boolean.TRUE, Boolean.TRUE) = true
396 ObjectUtils.equals(Boolean.TRUE, Boolean.FALSE) = false
400 <DT><B>Parameters:
</B><DD><CODE>object1
</CODE> - the first object, may be
<code>null
</code><DD><CODE>object2
</CODE> - the second object, may be
<code>null
</code>
401 <DT><B>Returns:
</B><DD><code>true
</code> if the values of both objects are the same
</DL>
406 <A NAME=
"hashCode(java.lang.Object)"><!-- --></A><H3>
409 public static int
<B>hashCode
</B>(java.lang.Object
obj)
</PRE>
411 <DD><p>Gets the hash code of an object returning zero when the
412 object is
<code>null
</code>.
</p>
415 ObjectUtils.hashCode(null) =
0
416 ObjectUtils.hashCode(obj) = obj.hashCode()
420 <DT><B>Parameters:
</B><DD><CODE>obj
</CODE> - the object to obtain the hash code of, may be
<code>null
</code>
421 <DT><B>Returns:
</B><DD>the hash code of the object, or zero if null
<DT><B>Since:
</B></DT>
428 <A NAME=
"identityToString(java.lang.Object)"><!-- --></A><H3>
429 identityToString
</H3>
431 public static java.lang.String
<B>identityToString
</B>(java.lang.Object
object)
</PRE>
433 <DD><p>Gets the toString that would be produced by
<code>Object
</code>
434 if a class did not override toString itself.
<code>null
</code>
435 will return
<code>null
</code>.
</p>
438 ObjectUtils.identityToString(null) = null
439 ObjectUtils.identityToString(
"") =
"java.lang.String@1e23"
440 ObjectUtils.identityToString(Boolean.TRUE) =
"java.lang.Boolean@7fa"
444 <DT><B>Parameters:
</B><DD><CODE>object
</CODE> - the object to create a toString for, may be
446 <DT><B>Returns:
</B><DD>the default toString text, or
<code>null
</code> if
447 <code>null
</code> passed in
</DL>
452 <A NAME=
"identityToString(java.lang.StringBuffer, java.lang.Object)"><!-- --></A><H3>
453 identityToString
</H3>
455 public static void
<B>identityToString
</B>(java.lang.StringBuffer
buffer,
456 java.lang.Object
object)
</PRE>
458 <DD><p>Appends the toString that would be produced by
<code>Object
</code>
459 if a class did not override toString itself.
<code>null
</code>
460 will throw a NullPointerException for either of the two parameters.
</p>
463 ObjectUtils.identityToString(buf,
"") = buf.append(
"java.lang.String@1e23"
464 ObjectUtils.identityToString(buf, Boolean.TRUE) = buf.append(
"java.lang.Boolean@7fa"
465 ObjectUtils.identityToString(buf, Boolean.TRUE) = buf.append(
"java.lang.Boolean@7fa")
469 <DT><B>Parameters:
</B><DD><CODE>buffer
</CODE> - the buffer to append to
<DD><CODE>object
</CODE> - the object to create a toString for
<DT><B>Since:
</B></DT>
476 <A NAME=
"appendIdentityToString(java.lang.StringBuffer, java.lang.Object)"><!-- --></A><H3>
477 appendIdentityToString
</H3>
479 public static java.lang.StringBuffer
<B>appendIdentityToString
</B>(java.lang.StringBuffer
buffer,
480 java.lang.Object
object)
</PRE>
482 <DD><B>Deprecated.
</B> <I>The design of this method is bad - see LANG-
360. Instead, use identityToString(StringBuffer, Object).
</I>
484 <DD><p>Appends the toString that would be produced by
<code>Object
</code>
485 if a class did not override toString itself.
<code>null
</code>
486 will return
<code>null
</code>.
</p>
489 ObjectUtils.appendIdentityToString(*, null) = null
490 ObjectUtils.appendIdentityToString(null,
"") =
"java.lang.String@1e23"
491 ObjectUtils.appendIdentityToString(null, Boolean.TRUE) =
"java.lang.Boolean@7fa"
492 ObjectUtils.appendIdentityToString(buf, Boolean.TRUE) = buf.append(
"java.lang.Boolean@7fa")
496 <DT><B>Parameters:
</B><DD><CODE>buffer
</CODE> - the buffer to append to, may be
<code>null
</code><DD><CODE>object
</CODE> - the object to create a toString for, may be
<code>null
</code>
497 <DT><B>Returns:
</B><DD>the default toString text, or
<code>null
</code> if
498 <code>null
</code> passed in
<DT><B>Since:
</B></DT>
505 <A NAME=
"toString(java.lang.Object)"><!-- --></A><H3>
508 public static java.lang.String
<B>toString
</B>(java.lang.Object
obj)
</PRE>
510 <DD><p>Gets the
<code>toString
</code> of an
<code>Object
</code> returning
511 an empty string (
"") if
<code>null
</code> input.
</p>
514 ObjectUtils.toString(null) =
""
515 ObjectUtils.toString(
"") =
""
516 ObjectUtils.toString(
"bat") =
"bat"
517 ObjectUtils.toString(Boolean.TRUE) =
"true"
521 <DT><B>Parameters:
</B><DD><CODE>obj
</CODE> - the Object to
<code>toString
</code>, may be null
522 <DT><B>Returns:
</B><DD>the passed in Object's toString, or nullStr if
<code>null
</code> input
<DT><B>Since:
</B></DT>
524 <DT><B>See Also:
</B><DD><A HREF=
"../../../../org/apache/commons/lang/StringUtils.html#defaultString(java.lang.String)"><CODE>StringUtils.defaultString(String)
</CODE></A>,
525 <CODE>String.valueOf(Object)
</CODE></DL>
530 <A NAME=
"toString(java.lang.Object, java.lang.String)"><!-- --></A><H3>
533 public static java.lang.String
<B>toString
</B>(java.lang.Object
obj,
534 java.lang.String
nullStr)
</PRE>
536 <DD><p>Gets the
<code>toString
</code> of an
<code>Object
</code> returning
537 a specified text if
<code>null
</code> input.
</p>
540 ObjectUtils.toString(null, null) = null
541 ObjectUtils.toString(null,
"null") =
"null"
542 ObjectUtils.toString(
"",
"null") =
""
543 ObjectUtils.toString(
"bat",
"null") =
"bat"
544 ObjectUtils.toString(Boolean.TRUE,
"null") =
"true"
548 <DT><B>Parameters:
</B><DD><CODE>obj
</CODE> - the Object to
<code>toString
</code>, may be null
<DD><CODE>nullStr
</CODE> - the String to return if
<code>null
</code> input, may be null
549 <DT><B>Returns:
</B><DD>the passed in Object's toString, or nullStr if
<code>null
</code> input
<DT><B>Since:
</B></DT>
551 <DT><B>See Also:
</B><DD><A HREF=
"../../../../org/apache/commons/lang/StringUtils.html#defaultString(java.lang.String, java.lang.String)"><CODE>StringUtils.defaultString(String,String)
</CODE></A>,
552 <CODE>String.valueOf(Object)
</CODE></DL>
557 <A NAME=
"min(java.lang.Comparable, java.lang.Comparable)"><!-- --></A><H3>
560 public static java.lang.Object
<B>min
</B>(java.lang.Comparable
c1,
561 java.lang.Comparable
c2)
</PRE>
563 <DD>Null safe comparison of Comparables.
566 <DT><B>Parameters:
</B><DD><CODE>c1
</CODE> - the first comparable, may be null
<DD><CODE>c2
</CODE> - the second comparable, may be null
567 <DT><B>Returns:
</B><DD><ul>
568 <li>If both objects are non-null and unequal, the lesser object.
569 <li>If both objects are non-null and equal, c1.
570 <li>If one of the comparables is null, the non-null object.
571 <li>If both the comparables are null, null is returned.
577 <A NAME=
"max(java.lang.Comparable, java.lang.Comparable)"><!-- --></A><H3>
580 public static java.lang.Object
<B>max
</B>(java.lang.Comparable
c1,
581 java.lang.Comparable
c2)
</PRE>
583 <DD>Null safe comparison of Comparables.
586 <DT><B>Parameters:
</B><DD><CODE>c1
</CODE> - the first comparable, may be null
<DD><CODE>c2
</CODE> - the second comparable, may be null
587 <DT><B>Returns:
</B><DD><ul>
588 <li>If both objects are non-null and unequal, the greater object.
589 <li>If both objects are non-null and equal, c1.
590 <li>If one of the comparables is null, the non-null object.
591 <li>If both the comparables are null, null is returned.
595 <!-- ========= END OF CLASS DATA ========= -->
599 <!-- ======= START OF BOTTOM NAVBAR ====== -->
600 <A NAME=
"navbar_bottom"><!-- --></A>
601 <A HREF=
"#skip-navbar_bottom" title=
"Skip navigation links"></A>
602 <TABLE BORDER=
"0" WIDTH=
"100%" CELLPADDING=
"1" CELLSPACING=
"0" SUMMARY=
"">
604 <TD COLSPAN=
3 BGCOLOR=
"#EEEEFF" CLASS=
"NavBarCell1">
605 <A NAME=
"navbar_bottom_firstrow"><!-- --></A>
606 <TABLE BORDER=
"0" CELLPADDING=
"0" CELLSPACING=
"3" SUMMARY=
"">
607 <TR ALIGN=
"center" VALIGN=
"top">
608 <TD BGCOLOR=
"#EEEEFF" CLASS=
"NavBarCell1"> <A HREF=
"../../../../overview-summary.html"><FONT CLASS=
"NavBarFont1"><B>Overview
</B></FONT></A> </TD>
609 <TD BGCOLOR=
"#EEEEFF" CLASS=
"NavBarCell1"> <A HREF=
"package-summary.html"><FONT CLASS=
"NavBarFont1"><B>Package
</B></FONT></A> </TD>
610 <TD BGCOLOR=
"#FFFFFF" CLASS=
"NavBarCell1Rev"> <FONT CLASS=
"NavBarFont1Rev"><B>Class
</B></FONT> </TD>
611 <TD BGCOLOR=
"#EEEEFF" CLASS=
"NavBarCell1"> <A HREF=
"class-use/ObjectUtils.html"><FONT CLASS=
"NavBarFont1"><B>Use
</B></FONT></A> </TD>
612 <TD BGCOLOR=
"#EEEEFF" CLASS=
"NavBarCell1"> <A HREF=
"package-tree.html"><FONT CLASS=
"NavBarFont1"><B>Tree
</B></FONT></A> </TD>
613 <TD BGCOLOR=
"#EEEEFF" CLASS=
"NavBarCell1"> <A HREF=
"../../../../deprecated-list.html"><FONT CLASS=
"NavBarFont1"><B>Deprecated
</B></FONT></A> </TD>
614 <TD BGCOLOR=
"#EEEEFF" CLASS=
"NavBarCell1"> <A HREF=
"../../../../index-all.html"><FONT CLASS=
"NavBarFont1"><B>Index
</B></FONT></A> </TD>
615 <TD BGCOLOR=
"#EEEEFF" CLASS=
"NavBarCell1"> <A HREF=
"../../../../help-doc.html"><FONT CLASS=
"NavBarFont1"><B>Help
</B></FONT></A> </TD>
619 <TD ALIGN=
"right" VALIGN=
"top" ROWSPAN=
3><EM>
625 <TD BGCOLOR=
"white" CLASS=
"NavBarCell2"><FONT SIZE=
"-2">
626 <A HREF=
"../../../../org/apache/commons/lang/NumberUtils.html" title=
"class in org.apache.commons.lang"><B>PREV CLASS
</B></A>
627 <A HREF=
"../../../../org/apache/commons/lang/ObjectUtils.Null.html" title=
"class in org.apache.commons.lang"><B>NEXT CLASS
</B></A></FONT></TD>
628 <TD BGCOLOR=
"white" CLASS=
"NavBarCell2"><FONT SIZE=
"-2">
629 <A HREF=
"../../../../index.html" target=
"_top"><B>FRAMES
</B></A>
630 <A HREF=
"ObjectUtils.html" target=
"_top"><B>NO FRAMES
</B></A>
631 <SCRIPT type=
"text/javascript">
634 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
639 <A HREF=
"../../../../allclasses-noframe.html"><B>All Classes
</B></A>
645 <TD VALIGN=
"top" CLASS=
"NavBarCell3"><FONT SIZE=
"-2">
646 SUMMARY:
<A HREF=
"#nested_class_summary">NESTED
</A> |
<A HREF=
"#field_summary">FIELD
</A> |
<A HREF=
"#constructor_summary">CONSTR
</A> |
<A HREF=
"#method_summary">METHOD
</A></FONT></TD>
647 <TD VALIGN=
"top" CLASS=
"NavBarCell3"><FONT SIZE=
"-2">
648 DETAIL:
<A HREF=
"#field_detail">FIELD
</A> |
<A HREF=
"#constructor_detail">CONSTR
</A> |
<A HREF=
"#method_detail">METHOD
</A></FONT></TD>
651 <A NAME=
"skip-navbar_bottom"></A>
652 <!-- ======== END OF BOTTOM NAVBAR ======= -->
655 Copyright ©
2001-
2008 <a href=
"http://www.apache.org/">The Apache Software Foundation
</a>. All Rights Reserved.