a whole bunch of stuff
[ephemerata.git] / Toady / lib / commons-lang-2.4 / apidocs / org / apache / commons / lang / ObjectUtils.html
blob167ab0f370be6354ad3cb1ff743728636522c033
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <!--NewPage-->
3 <HTML>
4 <HEAD>
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">
7 <TITLE>
8 ObjectUtils (Commons Lang 2.4 API)
9 </TITLE>
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)";
20 </SCRIPT>
22 </HEAD>
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="">
31 <TR>
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>&nbsp;</TD>
37 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
38 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
39 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/ObjectUtils.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
40 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
41 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
42 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
43 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
44 </TR>
45 </TABLE>
46 </TD>
47 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
48 </EM>
49 </TD>
50 </TR>
52 <TR>
53 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
54 &nbsp;<A HREF="../../../../org/apache/commons/lang/NumberUtils.html" title="class in org.apache.commons.lang"><B>PREV CLASS</B></A>&nbsp;
55 &nbsp;<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> &nbsp;
58 &nbsp;<A HREF="ObjectUtils.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
59 &nbsp;<SCRIPT type="text/javascript">
60 <!--
61 if(window==top) {
62 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
64 //-->
65 </SCRIPT>
66 <NOSCRIPT>
67 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
68 </NOSCRIPT>
70 </FONT></TD>
71 </TR>
72 <TR>
73 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
74 SUMMARY:&nbsp;<A HREF="#nested_class_summary">NESTED</A>&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
75 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
76 DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
77 </TR>
78 </TABLE>
79 <A NAME="skip-navbar_top"></A>
80 <!-- ========= END OF TOP NAVBAR ========= -->
82 <HR>
83 <!-- ======== START OF CLASS DATA ======== -->
84 <H2>
85 <FONT SIZE="-1">
86 org.apache.commons.lang</FONT>
87 <BR>
88 Class ObjectUtils</H2>
89 <PRE>
90 java.lang.Object
91 <IMG SRC="../../../../resources/inherit.gif" ALT="extended by"><B>org.apache.commons.lang.ObjectUtils</B>
92 </PRE>
93 <HR>
94 <DL>
95 <DT>public class <B>ObjectUtils</B><DT>extends java.lang.Object</DL>
97 <P>
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>
106 <DL>
107 <DT><B>Since:</B></DT>
108 <DD>1.0</DD>
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>
113 </DL>
114 <HR>
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>
124 </TR>
125 <TR BGCOLOR="white" CLASS="TableRowColor">
126 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
127 <CODE>static&nbsp;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>
130 <BR>
131 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Class used as a null placeholder where <code>null</code>
132 has another meaning.</TD>
133 </TR>
134 </TABLE>
135 &nbsp;
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>
143 </TR>
144 <TR BGCOLOR="white" CLASS="TableRowColor">
145 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
146 <CODE>static&nbsp;<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>
149 <BR>
150 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Singleton used as a <code>null</code> placeholder where
151 <code>null</code> has another meaning.</TD>
152 </TR>
153 </TABLE>
154 &nbsp;
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>
162 </TR>
163 <TR BGCOLOR="white" CLASS="TableRowColor">
164 <TD><CODE><B><A HREF="../../../../org/apache/commons/lang/ObjectUtils.html#ObjectUtils()">ObjectUtils</A></B>()</CODE>
166 <BR>
167 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>ObjectUtils</code> instances should NOT be constructed in
168 standard programming.</TD>
169 </TR>
170 </TABLE>
171 &nbsp;
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>
179 </TR>
180 <TR BGCOLOR="white" CLASS="TableRowColor">
181 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
182 <CODE>static&nbsp;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&nbsp;buffer,
184 java.lang.Object&nbsp;object)</CODE>
186 <BR>
187 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;<I>The design of this method is bad - see LANG-360. Instead, use identityToString(StringBuffer, Object).</I></TD>
188 </TR>
189 <TR BGCOLOR="white" CLASS="TableRowColor">
190 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
191 <CODE>static&nbsp;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&nbsp;object,
193 java.lang.Object&nbsp;defaultValue)</CODE>
195 <BR>
196 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a default value if the object passed is
197 <code>null</code>.</TD>
198 </TR>
199 <TR BGCOLOR="white" CLASS="TableRowColor">
200 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
201 <CODE>static&nbsp;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&nbsp;object1,
203 java.lang.Object&nbsp;object2)</CODE>
205 <BR>
206 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Compares two objects for equality, where either one or both
207 objects may be <code>null</code>.</TD>
208 </TR>
209 <TR BGCOLOR="white" CLASS="TableRowColor">
210 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
211 <CODE>static&nbsp;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&nbsp;obj)</CODE>
214 <BR>
215 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gets the hash code of an object returning zero when the
216 object is <code>null</code>.</TD>
217 </TR>
218 <TR BGCOLOR="white" CLASS="TableRowColor">
219 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
220 <CODE>static&nbsp;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&nbsp;object)</CODE>
223 <BR>
224 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gets the toString that would be produced by <code>Object</code>
225 if a class did not override toString itself.</TD>
226 </TR>
227 <TR BGCOLOR="white" CLASS="TableRowColor">
228 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
229 <CODE>static&nbsp;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&nbsp;buffer,
231 java.lang.Object&nbsp;object)</CODE>
233 <BR>
234 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Appends the toString that would be produced by <code>Object</code>
235 if a class did not override toString itself.</TD>
236 </TR>
237 <TR BGCOLOR="white" CLASS="TableRowColor">
238 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
239 <CODE>static&nbsp;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&nbsp;c1,
241 java.lang.Comparable&nbsp;c2)</CODE>
243 <BR>
244 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Null safe comparison of Comparables.</TD>
245 </TR>
246 <TR BGCOLOR="white" CLASS="TableRowColor">
247 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
248 <CODE>static&nbsp;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&nbsp;c1,
250 java.lang.Comparable&nbsp;c2)</CODE>
252 <BR>
253 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Null safe comparison of Comparables.</TD>
254 </TR>
255 <TR BGCOLOR="white" CLASS="TableRowColor">
256 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
257 <CODE>static&nbsp;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&nbsp;obj)</CODE>
260 <BR>
261 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gets the <code>toString</code> of an <code>Object</code> returning
262 an empty string ("") if <code>null</code> input.</TD>
263 </TR>
264 <TR BGCOLOR="white" CLASS="TableRowColor">
265 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
266 <CODE>static&nbsp;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&nbsp;obj,
268 java.lang.String&nbsp;nullStr)</CODE>
270 <BR>
271 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gets the <code>toString</code> of an <code>Object</code> returning
272 a specified text if <code>null</code> input.</TD>
273 </TR>
274 </TABLE>
275 &nbsp;<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>
279 </TR>
280 <TR BGCOLOR="white" CLASS="TableRowColor">
281 <TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
282 </TR>
283 </TABLE>
284 &nbsp;
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>
294 </TR>
295 </TABLE>
297 <A NAME="NULL"><!-- --></A><H3>
298 NULL</H3>
299 <PRE>
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>
301 <DL>
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
310 these two cases.</p>
312 <p>Another example is <code>Hashtable</code>, where <code>null</code>
313 cannot be stored.</p>
315 <p>This instance is Serializable.</p>
317 <DL>
318 </DL>
319 </DL>
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>
328 </TR>
329 </TABLE>
331 <A NAME="ObjectUtils()"><!-- --></A><H3>
332 ObjectUtils</H3>
333 <PRE>
334 public <B>ObjectUtils</B>()</PRE>
335 <DL>
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
341 to operate.</p>
343 </DL>
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>
352 </TR>
353 </TABLE>
355 <A NAME="defaultIfNull(java.lang.Object, java.lang.Object)"><!-- --></A><H3>
356 defaultIfNull</H3>
357 <PRE>
358 public static java.lang.Object <B>defaultIfNull</B>(java.lang.Object&nbsp;object,
359 java.lang.Object&nbsp;defaultValue)</PRE>
360 <DL>
361 <DD><p>Returns a default value if the object passed is
362 <code>null</code>.</p>
364 <pre>
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
370 </pre>
372 <DD><DL>
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>
375 </DD>
376 </DL>
377 <HR>
379 <A NAME="equals(java.lang.Object, java.lang.Object)"><!-- --></A><H3>
380 equals</H3>
381 <PRE>
382 public static boolean <B>equals</B>(java.lang.Object&nbsp;object1,
383 java.lang.Object&nbsp;object2)</PRE>
384 <DL>
385 <DD><p>Compares two objects for equality, where either one or both
386 objects may be <code>null</code>.</p>
388 <pre>
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
397 </pre>
399 <DD><DL>
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>
402 </DD>
403 </DL>
404 <HR>
406 <A NAME="hashCode(java.lang.Object)"><!-- --></A><H3>
407 hashCode</H3>
408 <PRE>
409 public static int <B>hashCode</B>(java.lang.Object&nbsp;obj)</PRE>
410 <DL>
411 <DD><p>Gets the hash code of an object returning zero when the
412 object is <code>null</code>.</p>
414 <pre>
415 ObjectUtils.hashCode(null) = 0
416 ObjectUtils.hashCode(obj) = obj.hashCode()
417 </pre>
419 <DD><DL>
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>
422 <DD>2.1</DD>
423 </DL>
424 </DD>
425 </DL>
426 <HR>
428 <A NAME="identityToString(java.lang.Object)"><!-- --></A><H3>
429 identityToString</H3>
430 <PRE>
431 public static java.lang.String <B>identityToString</B>(java.lang.Object&nbsp;object)</PRE>
432 <DL>
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>
437 <pre>
438 ObjectUtils.identityToString(null) = null
439 ObjectUtils.identityToString("") = "java.lang.String@1e23"
440 ObjectUtils.identityToString(Boolean.TRUE) = "java.lang.Boolean@7fa"
441 </pre>
443 <DD><DL>
444 <DT><B>Parameters:</B><DD><CODE>object</CODE> - the object to create a toString for, may be
445 <code>null</code>
446 <DT><B>Returns:</B><DD>the default toString text, or <code>null</code> if
447 <code>null</code> passed in</DL>
448 </DD>
449 </DL>
450 <HR>
452 <A NAME="identityToString(java.lang.StringBuffer, java.lang.Object)"><!-- --></A><H3>
453 identityToString</H3>
454 <PRE>
455 public static void <B>identityToString</B>(java.lang.StringBuffer&nbsp;buffer,
456 java.lang.Object&nbsp;object)</PRE>
457 <DL>
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>
462 <pre>
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")
466 </pre>
468 <DD><DL>
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>
470 <DD>2.4</DD>
471 </DL>
472 </DD>
473 </DL>
474 <HR>
476 <A NAME="appendIdentityToString(java.lang.StringBuffer, java.lang.Object)"><!-- --></A><H3>
477 appendIdentityToString</H3>
478 <PRE>
479 public static java.lang.StringBuffer <B>appendIdentityToString</B>(java.lang.StringBuffer&nbsp;buffer,
480 java.lang.Object&nbsp;object)</PRE>
481 <DL>
482 <DD><B>Deprecated.</B>&nbsp;<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>
488 <pre>
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")
493 </pre>
495 <DD><DL>
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>
499 <DD>2.0</DD>
500 </DL>
501 </DD>
502 </DL>
503 <HR>
505 <A NAME="toString(java.lang.Object)"><!-- --></A><H3>
506 toString</H3>
507 <PRE>
508 public static java.lang.String <B>toString</B>(java.lang.Object&nbsp;obj)</PRE>
509 <DL>
510 <DD><p>Gets the <code>toString</code> of an <code>Object</code> returning
511 an empty string ("") if <code>null</code> input.</p>
513 <pre>
514 ObjectUtils.toString(null) = ""
515 ObjectUtils.toString("") = ""
516 ObjectUtils.toString("bat") = "bat"
517 ObjectUtils.toString(Boolean.TRUE) = "true"
518 </pre>
520 <DD><DL>
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>
523 <DD>2.0</DD>
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>
526 </DD>
527 </DL>
528 <HR>
530 <A NAME="toString(java.lang.Object, java.lang.String)"><!-- --></A><H3>
531 toString</H3>
532 <PRE>
533 public static java.lang.String <B>toString</B>(java.lang.Object&nbsp;obj,
534 java.lang.String&nbsp;nullStr)</PRE>
535 <DL>
536 <DD><p>Gets the <code>toString</code> of an <code>Object</code> returning
537 a specified text if <code>null</code> input.</p>
539 <pre>
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"
545 </pre>
547 <DD><DL>
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>
550 <DD>2.0</DD>
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>
553 </DD>
554 </DL>
555 <HR>
557 <A NAME="min(java.lang.Comparable, java.lang.Comparable)"><!-- --></A><H3>
558 min</H3>
559 <PRE>
560 public static java.lang.Object <B>min</B>(java.lang.Comparable&nbsp;c1,
561 java.lang.Comparable&nbsp;c2)</PRE>
562 <DL>
563 <DD>Null safe comparison of Comparables.
565 <DD><DL>
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.
572 </ul></DL>
573 </DD>
574 </DL>
575 <HR>
577 <A NAME="max(java.lang.Comparable, java.lang.Comparable)"><!-- --></A><H3>
578 max</H3>
579 <PRE>
580 public static java.lang.Object <B>max</B>(java.lang.Comparable&nbsp;c1,
581 java.lang.Comparable&nbsp;c2)</PRE>
582 <DL>
583 <DD>Null safe comparison of Comparables.
585 <DD><DL>
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.
592 </ul></DL>
593 </DD>
594 </DL>
595 <!-- ========= END OF CLASS DATA ========= -->
596 <HR>
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="">
603 <TR>
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>&nbsp;</TD>
609 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
610 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
611 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/ObjectUtils.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
612 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
613 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
614 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
615 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
616 </TR>
617 </TABLE>
618 </TD>
619 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
620 </EM>
621 </TD>
622 </TR>
624 <TR>
625 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
626 &nbsp;<A HREF="../../../../org/apache/commons/lang/NumberUtils.html" title="class in org.apache.commons.lang"><B>PREV CLASS</B></A>&nbsp;
627 &nbsp;<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> &nbsp;
630 &nbsp;<A HREF="ObjectUtils.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
631 &nbsp;<SCRIPT type="text/javascript">
632 <!--
633 if(window==top) {
634 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
636 //-->
637 </SCRIPT>
638 <NOSCRIPT>
639 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
640 </NOSCRIPT>
642 </FONT></TD>
643 </TR>
644 <TR>
645 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
646 SUMMARY:&nbsp;<A HREF="#nested_class_summary">NESTED</A>&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
647 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
648 DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
649 </TR>
650 </TABLE>
651 <A NAME="skip-navbar_bottom"></A>
652 <!-- ======== END OF BOTTOM NAVBAR ======= -->
654 <HR>
655 Copyright © 2001-2008 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved.
656 </BODY>
657 </HTML>