a whole bunch of stuff
[ephemerata.git] / Toady / lib / commons-lang-2.4 / apidocs / org / apache / commons / lang / builder / HashCodeBuilder.html
blob8c6ca1db19c53af65bf47be87dda422da926cc7b
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:48 PDT 2008 -->
6 <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
7 <TITLE>
8 HashCodeBuilder (Commons Lang 2.4 API)
9 </TITLE>
11 <META NAME="keywords" CONTENT="org.apache.commons.lang.builder.HashCodeBuilder 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="HashCodeBuilder (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/HashCodeBuilder.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/builder/EqualsBuilder.html" title="class in org.apache.commons.lang.builder"><B>PREV CLASS</B></A>&nbsp;
55 &nbsp;<A HREF="../../../../../org/apache/commons/lang/builder/ReflectionToStringBuilder.html" title="class in org.apache.commons.lang.builder"><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="HashCodeBuilder.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;NESTED&nbsp;|&nbsp;FIELD&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;FIELD&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.builder</FONT>
87 <BR>
88 Class HashCodeBuilder</H2>
89 <PRE>
90 java.lang.Object
91 <IMG SRC="../../../../../resources/inherit.gif" ALT="extended by"><B>org.apache.commons.lang.builder.HashCodeBuilder</B>
92 </PRE>
93 <HR>
94 <DL>
95 <DT>public class <B>HashCodeBuilder</B><DT>extends java.lang.Object</DL>
97 <P>
98 <p>
99 Assists in implementing <CODE>Object.hashCode()</CODE> methods.
100 </p>
103 This class enables a good <code>hashCode</code> method to be built for any class. It follows the rules laid out in
104 the book <a href="http://java.sun.com/docs/books/effective/index.html">Effective Java</a> by Joshua Bloch. Writing a
105 good <code>hashCode</code> method is actually quite difficult. This class aims to simplify the process.
106 </p>
109 All relevant fields from the object should be included in the <code>hashCode</code> method. Derived fields may be
110 excluded. In general, any field used in the <code>equals</code> method must be used in the <code>hashCode</code>
111 method.
112 </p>
115 To use this class write code as follows:
116 </p>
118 <pre>
119 public class Person {
120 String name;
121 int age;
122 boolean smoker;
125 public int hashCode() {
126 // you pick a hard-coded, randomly chosen, non-zero, odd number
127 // ideally different for each class
128 return new HashCodeBuilder(17, 37).
129 append(name).
130 append(age).
131 append(smoker).
132 toHashCode();
135 </pre>
138 If required, the superclass <code>hashCode()</code> can be added using <A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#appendSuper(int)"><CODE>appendSuper(int)</CODE></A>.
139 </p>
142 Alternatively, there is a method that uses reflection to determine the fields to test. Because these fields are
143 usually private, the method, <code>reflectionHashCode</code>, uses <code>AccessibleObject.setAccessible</code>
144 to change the visibility of the fields. This will fail under a security manager, unless the appropriate permissions
145 are set up correctly. It is also slower than testing explicitly.
146 </p>
149 A typical invocation for this method would look like:
150 </p>
152 <pre>
153 public int hashCode() {
154 return HashCodeBuilder.reflectionHashCode(this);
156 </pre>
160 <DL>
161 <DT><B>Since:</B></DT>
162 <DD>1.0</DD>
163 <DT><B>Version:</B></DT>
164 <DD>$Id: HashCodeBuilder.java 564070 2007-08-09 01:58:11Z bayard $</DD>
165 <DT><B>Author:</B></DT>
166 <DD>Stephen Colebourne, Gary Gregory, Pete Gieser</DD>
167 </DL>
168 <HR>
171 <!-- ======== NESTED CLASS SUMMARY ======== -->
174 <!-- =========== FIELD SUMMARY =========== -->
177 <!-- ======== CONSTRUCTOR SUMMARY ======== -->
179 <A NAME="constructor_summary"><!-- --></A>
180 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
181 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
182 <TD COLSPAN=2><FONT SIZE="+2">
183 <B>Constructor Summary</B></FONT></TD>
184 </TR>
185 <TR BGCOLOR="white" CLASS="TableRowColor">
186 <TD><CODE><B><A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#HashCodeBuilder()">HashCodeBuilder</A></B>()</CODE>
188 <BR>
189 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
190 Uses two hard coded choices for the constants needed to build a <code>hashCode</code>.</TD>
191 </TR>
192 <TR BGCOLOR="white" CLASS="TableRowColor">
193 <TD><CODE><B><A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#HashCodeBuilder(int, int)">HashCodeBuilder</A></B>(int&nbsp;initialNonZeroOddNumber,
194 int&nbsp;multiplierNonZeroOddNumber)</CODE>
196 <BR>
197 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
198 Two randomly chosen, non-zero, odd numbers must be passed in.</TD>
199 </TR>
200 </TABLE>
201 &nbsp;
202 <!-- ========== METHOD SUMMARY =========== -->
204 <A NAME="method_summary"><!-- --></A>
205 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
206 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
207 <TD COLSPAN=2><FONT SIZE="+2">
208 <B>Method Summary</B></FONT></TD>
209 </TR>
210 <TR BGCOLOR="white" CLASS="TableRowColor">
211 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
212 <CODE>&nbsp;<A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A></CODE></FONT></TD>
213 <TD><CODE><B><A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#append(boolean)">append</A></B>(boolean&nbsp;value)</CODE>
215 <BR>
216 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
217 Append a <code>hashCode</code> for a <code>boolean</code>.</TD>
218 </TR>
219 <TR BGCOLOR="white" CLASS="TableRowColor">
220 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
221 <CODE>&nbsp;<A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A></CODE></FONT></TD>
222 <TD><CODE><B><A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#append(boolean[])">append</A></B>(boolean[]&nbsp;array)</CODE>
224 <BR>
225 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
226 Append a <code>hashCode</code> for a <code>boolean</code> array.</TD>
227 </TR>
228 <TR BGCOLOR="white" CLASS="TableRowColor">
229 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
230 <CODE>&nbsp;<A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A></CODE></FONT></TD>
231 <TD><CODE><B><A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#append(byte)">append</A></B>(byte&nbsp;value)</CODE>
233 <BR>
234 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
235 Append a <code>hashCode</code> for a <code>byte</code>.</TD>
236 </TR>
237 <TR BGCOLOR="white" CLASS="TableRowColor">
238 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
239 <CODE>&nbsp;<A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A></CODE></FONT></TD>
240 <TD><CODE><B><A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#append(byte[])">append</A></B>(byte[]&nbsp;array)</CODE>
242 <BR>
243 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
244 Append a <code>hashCode</code> for a <code>byte</code> array.</TD>
245 </TR>
246 <TR BGCOLOR="white" CLASS="TableRowColor">
247 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
248 <CODE>&nbsp;<A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A></CODE></FONT></TD>
249 <TD><CODE><B><A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#append(char)">append</A></B>(char&nbsp;value)</CODE>
251 <BR>
252 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
253 Append a <code>hashCode</code> for a <code>char</code>.</TD>
254 </TR>
255 <TR BGCOLOR="white" CLASS="TableRowColor">
256 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
257 <CODE>&nbsp;<A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A></CODE></FONT></TD>
258 <TD><CODE><B><A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#append(char[])">append</A></B>(char[]&nbsp;array)</CODE>
260 <BR>
261 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
262 Append a <code>hashCode</code> for a <code>char</code> array.</TD>
263 </TR>
264 <TR BGCOLOR="white" CLASS="TableRowColor">
265 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
266 <CODE>&nbsp;<A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A></CODE></FONT></TD>
267 <TD><CODE><B><A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#append(double)">append</A></B>(double&nbsp;value)</CODE>
269 <BR>
270 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
271 Append a <code>hashCode</code> for a <code>double</code>.</TD>
272 </TR>
273 <TR BGCOLOR="white" CLASS="TableRowColor">
274 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
275 <CODE>&nbsp;<A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A></CODE></FONT></TD>
276 <TD><CODE><B><A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#append(double[])">append</A></B>(double[]&nbsp;array)</CODE>
278 <BR>
279 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
280 Append a <code>hashCode</code> for a <code>double</code> array.</TD>
281 </TR>
282 <TR BGCOLOR="white" CLASS="TableRowColor">
283 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
284 <CODE>&nbsp;<A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A></CODE></FONT></TD>
285 <TD><CODE><B><A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#append(float)">append</A></B>(float&nbsp;value)</CODE>
287 <BR>
288 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
289 Append a <code>hashCode</code> for a <code>float</code>.</TD>
290 </TR>
291 <TR BGCOLOR="white" CLASS="TableRowColor">
292 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
293 <CODE>&nbsp;<A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A></CODE></FONT></TD>
294 <TD><CODE><B><A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#append(float[])">append</A></B>(float[]&nbsp;array)</CODE>
296 <BR>
297 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
298 Append a <code>hashCode</code> for a <code>float</code> array.</TD>
299 </TR>
300 <TR BGCOLOR="white" CLASS="TableRowColor">
301 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
302 <CODE>&nbsp;<A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A></CODE></FONT></TD>
303 <TD><CODE><B><A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#append(int)">append</A></B>(int&nbsp;value)</CODE>
305 <BR>
306 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
307 Append a <code>hashCode</code> for an <code>int</code>.</TD>
308 </TR>
309 <TR BGCOLOR="white" CLASS="TableRowColor">
310 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
311 <CODE>&nbsp;<A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A></CODE></FONT></TD>
312 <TD><CODE><B><A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#append(int[])">append</A></B>(int[]&nbsp;array)</CODE>
314 <BR>
315 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
316 Append a <code>hashCode</code> for an <code>int</code> array.</TD>
317 </TR>
318 <TR BGCOLOR="white" CLASS="TableRowColor">
319 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
320 <CODE>&nbsp;<A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A></CODE></FONT></TD>
321 <TD><CODE><B><A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#append(long)">append</A></B>(long&nbsp;value)</CODE>
323 <BR>
324 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
325 Append a <code>hashCode</code> for a <code>long</code>.</TD>
326 </TR>
327 <TR BGCOLOR="white" CLASS="TableRowColor">
328 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
329 <CODE>&nbsp;<A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A></CODE></FONT></TD>
330 <TD><CODE><B><A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#append(long[])">append</A></B>(long[]&nbsp;array)</CODE>
332 <BR>
333 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
334 Append a <code>hashCode</code> for a <code>long</code> array.</TD>
335 </TR>
336 <TR BGCOLOR="white" CLASS="TableRowColor">
337 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
338 <CODE>&nbsp;<A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A></CODE></FONT></TD>
339 <TD><CODE><B><A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#append(java.lang.Object)">append</A></B>(java.lang.Object&nbsp;object)</CODE>
341 <BR>
342 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
343 Append a <code>hashCode</code> for an <code>Object</code>.</TD>
344 </TR>
345 <TR BGCOLOR="white" CLASS="TableRowColor">
346 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
347 <CODE>&nbsp;<A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A></CODE></FONT></TD>
348 <TD><CODE><B><A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#append(java.lang.Object[])">append</A></B>(java.lang.Object[]&nbsp;array)</CODE>
350 <BR>
351 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
352 Append a <code>hashCode</code> for an <code>Object</code> array.</TD>
353 </TR>
354 <TR BGCOLOR="white" CLASS="TableRowColor">
355 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
356 <CODE>&nbsp;<A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A></CODE></FONT></TD>
357 <TD><CODE><B><A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#append(short)">append</A></B>(short&nbsp;value)</CODE>
359 <BR>
360 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
361 Append a <code>hashCode</code> for a <code>short</code>.</TD>
362 </TR>
363 <TR BGCOLOR="white" CLASS="TableRowColor">
364 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
365 <CODE>&nbsp;<A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A></CODE></FONT></TD>
366 <TD><CODE><B><A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#append(short[])">append</A></B>(short[]&nbsp;array)</CODE>
368 <BR>
369 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
370 Append a <code>hashCode</code> for a <code>short</code> array.</TD>
371 </TR>
372 <TR BGCOLOR="white" CLASS="TableRowColor">
373 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
374 <CODE>&nbsp;<A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A></CODE></FONT></TD>
375 <TD><CODE><B><A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#appendSuper(int)">appendSuper</A></B>(int&nbsp;superHashCode)</CODE>
377 <BR>
378 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
379 Adds the result of super.hashCode() to this builder.</TD>
380 </TR>
381 <TR BGCOLOR="white" CLASS="TableRowColor">
382 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
383 <CODE>static&nbsp;int</CODE></FONT></TD>
384 <TD><CODE><B><A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#reflectionHashCode(int, int, java.lang.Object)">reflectionHashCode</A></B>(int&nbsp;initialNonZeroOddNumber,
385 int&nbsp;multiplierNonZeroOddNumber,
386 java.lang.Object&nbsp;object)</CODE>
388 <BR>
389 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
390 This method uses reflection to build a valid hash code.</TD>
391 </TR>
392 <TR BGCOLOR="white" CLASS="TableRowColor">
393 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
394 <CODE>static&nbsp;int</CODE></FONT></TD>
395 <TD><CODE><B><A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#reflectionHashCode(int, int, java.lang.Object, boolean)">reflectionHashCode</A></B>(int&nbsp;initialNonZeroOddNumber,
396 int&nbsp;multiplierNonZeroOddNumber,
397 java.lang.Object&nbsp;object,
398 boolean&nbsp;testTransients)</CODE>
400 <BR>
401 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
402 This method uses reflection to build a valid hash code.</TD>
403 </TR>
404 <TR BGCOLOR="white" CLASS="TableRowColor">
405 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
406 <CODE>static&nbsp;int</CODE></FONT></TD>
407 <TD><CODE><B><A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#reflectionHashCode(int, int, java.lang.Object, boolean, java.lang.Class)">reflectionHashCode</A></B>(int&nbsp;initialNonZeroOddNumber,
408 int&nbsp;multiplierNonZeroOddNumber,
409 java.lang.Object&nbsp;object,
410 boolean&nbsp;testTransients,
411 java.lang.Class&nbsp;reflectUpToClass)</CODE>
413 <BR>
414 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Calls <A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#reflectionHashCode(int, int, java.lang.Object, boolean, java.lang.Class, java.lang.String[])"><CODE>reflectionHashCode(int, int, Object, boolean, Class, String[])</CODE></A> with excludeFields set to
415 <code>null</code>.</TD>
416 </TR>
417 <TR BGCOLOR="white" CLASS="TableRowColor">
418 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
419 <CODE>static&nbsp;int</CODE></FONT></TD>
420 <TD><CODE><B><A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#reflectionHashCode(int, int, java.lang.Object, boolean, java.lang.Class, java.lang.String[])">reflectionHashCode</A></B>(int&nbsp;initialNonZeroOddNumber,
421 int&nbsp;multiplierNonZeroOddNumber,
422 java.lang.Object&nbsp;object,
423 boolean&nbsp;testTransients,
424 java.lang.Class&nbsp;reflectUpToClass,
425 java.lang.String[]&nbsp;excludeFields)</CODE>
427 <BR>
428 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
429 This method uses reflection to build a valid hash code.</TD>
430 </TR>
431 <TR BGCOLOR="white" CLASS="TableRowColor">
432 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
433 <CODE>static&nbsp;int</CODE></FONT></TD>
434 <TD><CODE><B><A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#reflectionHashCode(java.lang.Object)">reflectionHashCode</A></B>(java.lang.Object&nbsp;object)</CODE>
436 <BR>
437 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
438 This method uses reflection to build a valid hash code.</TD>
439 </TR>
440 <TR BGCOLOR="white" CLASS="TableRowColor">
441 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
442 <CODE>static&nbsp;int</CODE></FONT></TD>
443 <TD><CODE><B><A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#reflectionHashCode(java.lang.Object, boolean)">reflectionHashCode</A></B>(java.lang.Object&nbsp;object,
444 boolean&nbsp;testTransients)</CODE>
446 <BR>
447 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
448 This method uses reflection to build a valid hash code.</TD>
449 </TR>
450 <TR BGCOLOR="white" CLASS="TableRowColor">
451 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
452 <CODE>static&nbsp;int</CODE></FONT></TD>
453 <TD><CODE><B><A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#reflectionHashCode(java.lang.Object, java.util.Collection)">reflectionHashCode</A></B>(java.lang.Object&nbsp;object,
454 java.util.Collection&nbsp;excludeFields)</CODE>
456 <BR>
457 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
458 This method uses reflection to build a valid hash code.</TD>
459 </TR>
460 <TR BGCOLOR="white" CLASS="TableRowColor">
461 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
462 <CODE>static&nbsp;int</CODE></FONT></TD>
463 <TD><CODE><B><A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#reflectionHashCode(java.lang.Object, java.lang.String[])">reflectionHashCode</A></B>(java.lang.Object&nbsp;object,
464 java.lang.String[]&nbsp;excludeFields)</CODE>
466 <BR>
467 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
468 This method uses reflection to build a valid hash code.</TD>
469 </TR>
470 <TR BGCOLOR="white" CLASS="TableRowColor">
471 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
472 <CODE>&nbsp;int</CODE></FONT></TD>
473 <TD><CODE><B><A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#toHashCode()">toHashCode</A></B>()</CODE>
475 <BR>
476 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
477 Return the computed <code>hashCode</code>.</TD>
478 </TR>
479 </TABLE>
480 &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
481 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
482 <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
483 <TD><B>Methods inherited from class java.lang.Object</B></TD>
484 </TR>
485 <TR BGCOLOR="white" CLASS="TableRowColor">
486 <TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
487 </TR>
488 </TABLE>
489 &nbsp;
492 <!-- ============ FIELD DETAIL =========== -->
495 <!-- ========= CONSTRUCTOR DETAIL ======== -->
497 <A NAME="constructor_detail"><!-- --></A>
498 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
499 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
500 <TD COLSPAN=1><FONT SIZE="+2">
501 <B>Constructor Detail</B></FONT></TD>
502 </TR>
503 </TABLE>
505 <A NAME="HashCodeBuilder()"><!-- --></A><H3>
506 HashCodeBuilder</H3>
507 <PRE>
508 public <B>HashCodeBuilder</B>()</PRE>
509 <DL>
510 <DD><p>
511 Uses two hard coded choices for the constants needed to build a <code>hashCode</code>.
512 </p>
514 </DL>
515 <HR>
517 <A NAME="HashCodeBuilder(int, int)"><!-- --></A><H3>
518 HashCodeBuilder</H3>
519 <PRE>
520 public <B>HashCodeBuilder</B>(int&nbsp;initialNonZeroOddNumber,
521 int&nbsp;multiplierNonZeroOddNumber)</PRE>
522 <DL>
523 <DD><p>
524 Two randomly chosen, non-zero, odd numbers must be passed in. Ideally these should be different for each class,
525 however this is not vital.
526 </p>
529 Prime numbers are preferred, especially for the multiplier.
530 </p>
532 <DT><B>Parameters:</B><DD><CODE>initialNonZeroOddNumber</CODE> - a non-zero, odd number used as the initial value<DD><CODE>multiplierNonZeroOddNumber</CODE> - a non-zero, odd number used as the multiplier
533 <DT><B>Throws:</B>
534 <DD><CODE>java.lang.IllegalArgumentException</CODE> - if the number is zero or even</DL>
536 <!-- ============ METHOD DETAIL ========== -->
538 <A NAME="method_detail"><!-- --></A>
539 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
540 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
541 <TD COLSPAN=1><FONT SIZE="+2">
542 <B>Method Detail</B></FONT></TD>
543 </TR>
544 </TABLE>
546 <A NAME="reflectionHashCode(int, int, java.lang.Object)"><!-- --></A><H3>
547 reflectionHashCode</H3>
548 <PRE>
549 public static int <B>reflectionHashCode</B>(int&nbsp;initialNonZeroOddNumber,
550 int&nbsp;multiplierNonZeroOddNumber,
551 java.lang.Object&nbsp;object)</PRE>
552 <DL>
553 <DD><p>
554 This method uses reflection to build a valid hash code.
555 </p>
558 It uses <code>AccessibleObject.setAccessible</code> to gain access to private fields. This means that it will
559 throw a security exception if run under a security manager, if the permissions are not set up correctly. It is
560 also not as efficient as testing explicitly.
561 </p>
564 Transient members will be not be used, as they are likely derived fields, and not part of the value of the
565 <code>Object</code>.
566 </p>
569 Static fields will not be tested. Superclass fields will be included.
570 </p>
573 Two randomly chosen, non-zero, odd numbers must be passed in. Ideally these should be different for each class,
574 however this is not vital. Prime numbers are preferred, especially for the multiplier.
575 </p>
577 <DD><DL>
578 <DT><B>Parameters:</B><DD><CODE>initialNonZeroOddNumber</CODE> - a non-zero, odd number used as the initial value<DD><CODE>multiplierNonZeroOddNumber</CODE> - a non-zero, odd number used as the multiplier<DD><CODE>object</CODE> - the Object to create a <code>hashCode</code> for
579 <DT><B>Returns:</B><DD>int hash code
580 <DT><B>Throws:</B>
581 <DD><CODE>java.lang.IllegalArgumentException</CODE> - if the Object is <code>null</code>
582 <DD><CODE>java.lang.IllegalArgumentException</CODE> - if the number is zero or even</DL>
583 </DD>
584 </DL>
585 <HR>
587 <A NAME="reflectionHashCode(int, int, java.lang.Object, boolean)"><!-- --></A><H3>
588 reflectionHashCode</H3>
589 <PRE>
590 public static int <B>reflectionHashCode</B>(int&nbsp;initialNonZeroOddNumber,
591 int&nbsp;multiplierNonZeroOddNumber,
592 java.lang.Object&nbsp;object,
593 boolean&nbsp;testTransients)</PRE>
594 <DL>
595 <DD><p>
596 This method uses reflection to build a valid hash code.
597 </p>
600 It uses <code>AccessibleObject.setAccessible</code> to gain access to private fields. This means that it will
601 throw a security exception if run under a security manager, if the permissions are not set up correctly. It is
602 also not as efficient as testing explicitly.
603 </p>
606 If the TestTransients parameter is set to <code>true</code>, transient members will be tested, otherwise they
607 are ignored, as they are likely derived fields, and not part of the value of the <code>Object</code>.
608 </p>
611 Static fields will not be tested. Superclass fields will be included.
612 </p>
615 Two randomly chosen, non-zero, odd numbers must be passed in. Ideally these should be different for each class,
616 however this is not vital. Prime numbers are preferred, especially for the multiplier.
617 </p>
619 <DD><DL>
620 <DT><B>Parameters:</B><DD><CODE>initialNonZeroOddNumber</CODE> - a non-zero, odd number used as the initial value<DD><CODE>multiplierNonZeroOddNumber</CODE> - a non-zero, odd number used as the multiplier<DD><CODE>object</CODE> - the Object to create a <code>hashCode</code> for<DD><CODE>testTransients</CODE> - whether to include transient fields
621 <DT><B>Returns:</B><DD>int hash code
622 <DT><B>Throws:</B>
623 <DD><CODE>java.lang.IllegalArgumentException</CODE> - if the Object is <code>null</code>
624 <DD><CODE>java.lang.IllegalArgumentException</CODE> - if the number is zero or even</DL>
625 </DD>
626 </DL>
627 <HR>
629 <A NAME="reflectionHashCode(int, int, java.lang.Object, boolean, java.lang.Class)"><!-- --></A><H3>
630 reflectionHashCode</H3>
631 <PRE>
632 public static int <B>reflectionHashCode</B>(int&nbsp;initialNonZeroOddNumber,
633 int&nbsp;multiplierNonZeroOddNumber,
634 java.lang.Object&nbsp;object,
635 boolean&nbsp;testTransients,
636 java.lang.Class&nbsp;reflectUpToClass)</PRE>
637 <DL>
638 <DD>Calls <A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html#reflectionHashCode(int, int, java.lang.Object, boolean, java.lang.Class, java.lang.String[])"><CODE>reflectionHashCode(int, int, Object, boolean, Class, String[])</CODE></A> with excludeFields set to
639 <code>null</code>.
641 <DD><DL>
642 <DT><B>Parameters:</B><DD><CODE>initialNonZeroOddNumber</CODE> - a non-zero, odd number used as the initial value<DD><CODE>multiplierNonZeroOddNumber</CODE> - a non-zero, odd number used as the multiplier<DD><CODE>object</CODE> - the Object to create a <code>hashCode</code> for<DD><CODE>testTransients</CODE> - whether to include transient fields<DD><CODE>reflectUpToClass</CODE> - the superclass to reflect up to (inclusive), may be <code>null</code>
643 <DT><B>Returns:</B><DD>int hash code</DL>
644 </DD>
645 </DL>
646 <HR>
648 <A NAME="reflectionHashCode(int, int, java.lang.Object, boolean, java.lang.Class, java.lang.String[])"><!-- --></A><H3>
649 reflectionHashCode</H3>
650 <PRE>
651 public static int <B>reflectionHashCode</B>(int&nbsp;initialNonZeroOddNumber,
652 int&nbsp;multiplierNonZeroOddNumber,
653 java.lang.Object&nbsp;object,
654 boolean&nbsp;testTransients,
655 java.lang.Class&nbsp;reflectUpToClass,
656 java.lang.String[]&nbsp;excludeFields)</PRE>
657 <DL>
658 <DD><p>
659 This method uses reflection to build a valid hash code.
660 </p>
663 It uses <code>AccessibleObject.setAccessible</code> to gain access to private fields. This means that it will
664 throw a security exception if run under a security manager, if the permissions are not set up correctly. It is
665 also not as efficient as testing explicitly.
666 </p>
669 If the TestTransients parameter is set to <code>true</code>, transient members will be tested, otherwise they
670 are ignored, as they are likely derived fields, and not part of the value of the <code>Object</code>.
671 </p>
674 Static fields will not be included. Superclass fields will be included up to and including the specified
675 superclass. A null superclass is treated as java.lang.Object.
676 </p>
679 Two randomly chosen, non-zero, odd numbers must be passed in. Ideally these should be different for each class,
680 however this is not vital. Prime numbers are preferred, especially for the multiplier.
681 </p>
683 <DD><DL>
684 <DT><B>Parameters:</B><DD><CODE>initialNonZeroOddNumber</CODE> - a non-zero, odd number used as the initial value<DD><CODE>multiplierNonZeroOddNumber</CODE> - a non-zero, odd number used as the multiplier<DD><CODE>object</CODE> - the Object to create a <code>hashCode</code> for<DD><CODE>testTransients</CODE> - whether to include transient fields<DD><CODE>reflectUpToClass</CODE> - the superclass to reflect up to (inclusive), may be <code>null</code><DD><CODE>excludeFields</CODE> - array of field names to exclude from use in calculation of hash code
685 <DT><B>Returns:</B><DD>int hash code
686 <DT><B>Throws:</B>
687 <DD><CODE>java.lang.IllegalArgumentException</CODE> - if the Object is <code>null</code>
688 <DD><CODE>java.lang.IllegalArgumentException</CODE> - if the number is zero or even<DT><B>Since:</B></DT>
689 <DD>2.0</DD>
690 </DL>
691 </DD>
692 </DL>
693 <HR>
695 <A NAME="reflectionHashCode(java.lang.Object)"><!-- --></A><H3>
696 reflectionHashCode</H3>
697 <PRE>
698 public static int <B>reflectionHashCode</B>(java.lang.Object&nbsp;object)</PRE>
699 <DL>
700 <DD><p>
701 This method uses reflection to build a valid hash code.
702 </p>
705 This constructor uses two hard coded choices for the constants needed to build a hash code.
706 </p>
709 It uses <code>AccessibleObject.setAccessible</code> to gain access to private fields. This means that it will
710 throw a security exception if run under a security manager, if the permissions are not set up correctly. It is
711 also not as efficient as testing explicitly.
712 </p>
715 Transient members will be not be used, as they are likely derived fields, and not part of the value of the
716 <code>Object</code>.
717 </p>
720 Static fields will not be tested. Superclass fields will be included.
721 </p>
723 <DD><DL>
724 <DT><B>Parameters:</B><DD><CODE>object</CODE> - the Object to create a <code>hashCode</code> for
725 <DT><B>Returns:</B><DD>int hash code
726 <DT><B>Throws:</B>
727 <DD><CODE>java.lang.IllegalArgumentException</CODE> - if the object is <code>null</code></DL>
728 </DD>
729 </DL>
730 <HR>
732 <A NAME="reflectionHashCode(java.lang.Object, boolean)"><!-- --></A><H3>
733 reflectionHashCode</H3>
734 <PRE>
735 public static int <B>reflectionHashCode</B>(java.lang.Object&nbsp;object,
736 boolean&nbsp;testTransients)</PRE>
737 <DL>
738 <DD><p>
739 This method uses reflection to build a valid hash code.
740 </p>
743 This constructor uses two hard coded choices for the constants needed to build a hash code.
744 </p>
747 It uses <code>AccessibleObject.setAccessible</code> to gain access to private fields. This means that it will
748 throw a security exception if run under a security manager, if the permissions are not set up correctly. It is
749 also not as efficient as testing explicitly.
750 </p>
753 If the TestTransients parameter is set to <code>true</code>, transient members will be tested, otherwise they
754 are ignored, as they are likely derived fields, and not part of the value of the <code>Object</code>.
755 </p>
758 Static fields will not be tested. Superclass fields will be included.
759 </p>
761 <DD><DL>
762 <DT><B>Parameters:</B><DD><CODE>object</CODE> - the Object to create a <code>hashCode</code> for<DD><CODE>testTransients</CODE> - whether to include transient fields
763 <DT><B>Returns:</B><DD>int hash code
764 <DT><B>Throws:</B>
765 <DD><CODE>java.lang.IllegalArgumentException</CODE> - if the object is <code>null</code></DL>
766 </DD>
767 </DL>
768 <HR>
770 <A NAME="reflectionHashCode(java.lang.Object, java.util.Collection)"><!-- --></A><H3>
771 reflectionHashCode</H3>
772 <PRE>
773 public static int <B>reflectionHashCode</B>(java.lang.Object&nbsp;object,
774 java.util.Collection&nbsp;excludeFields)</PRE>
775 <DL>
776 <DD><p>
777 This method uses reflection to build a valid hash code.
778 </p>
781 This constructor uses two hard coded choices for the constants needed to build a hash code.
782 </p>
785 It uses <code>AccessibleObject.setAccessible</code> to gain access to private fields. This means that it will
786 throw a security exception if run under a security manager, if the permissions are not set up correctly. It is
787 also not as efficient as testing explicitly.
788 </p>
791 Transient members will be not be used, as they are likely derived fields, and not part of the value of the
792 <code>Object</code>.
793 </p>
796 Static fields will not be tested. Superclass fields will be included.
797 </p>
799 <DD><DL>
800 <DT><B>Parameters:</B><DD><CODE>object</CODE> - the Object to create a <code>hashCode</code> for<DD><CODE>excludeFields</CODE> - Collection of String field names to exclude from use in calculation of hash code
801 <DT><B>Returns:</B><DD>int hash code
802 <DT><B>Throws:</B>
803 <DD><CODE>java.lang.IllegalArgumentException</CODE> - if the object is <code>null</code></DL>
804 </DD>
805 </DL>
806 <HR>
808 <A NAME="reflectionHashCode(java.lang.Object, java.lang.String[])"><!-- --></A><H3>
809 reflectionHashCode</H3>
810 <PRE>
811 public static int <B>reflectionHashCode</B>(java.lang.Object&nbsp;object,
812 java.lang.String[]&nbsp;excludeFields)</PRE>
813 <DL>
814 <DD><p>
815 This method uses reflection to build a valid hash code.
816 </p>
819 This constructor uses two hard coded choices for the constants needed to build a hash code.
820 </p>
823 It uses <code>AccessibleObject.setAccessible</code> to gain access to private fields. This means that it will
824 throw a security exception if run under a security manager, if the permissions are not set up correctly. It is
825 also not as efficient as testing explicitly.
826 </p>
829 Transient members will be not be used, as they are likely derived fields, and not part of the value of the
830 <code>Object</code>.
831 </p>
834 Static fields will not be tested. Superclass fields will be included.
835 </p>
837 <DD><DL>
838 <DT><B>Parameters:</B><DD><CODE>object</CODE> - the Object to create a <code>hashCode</code> for<DD><CODE>excludeFields</CODE> - array of field names to exclude from use in calculation of hash code
839 <DT><B>Returns:</B><DD>int hash code
840 <DT><B>Throws:</B>
841 <DD><CODE>java.lang.IllegalArgumentException</CODE> - if the object is <code>null</code></DL>
842 </DD>
843 </DL>
844 <HR>
846 <A NAME="append(boolean)"><!-- --></A><H3>
847 append</H3>
848 <PRE>
849 public <A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A> <B>append</B>(boolean&nbsp;value)</PRE>
850 <DL>
851 <DD><p>
852 Append a <code>hashCode</code> for a <code>boolean</code>.
853 </p>
855 This adds <code>iConstant * 1</code> to the <code>hashCode</code> and not a <code>1231</code> or
856 <code>1237</code> as done in java.lang.Boolean. This is in accordance with the <quote>Effective Java</quote>
857 design.
858 </p>
860 <DD><DL>
861 <DT><B>Parameters:</B><DD><CODE>value</CODE> - the boolean to add to the <code>hashCode</code>
862 <DT><B>Returns:</B><DD>this</DL>
863 </DD>
864 </DL>
865 <HR>
867 <A NAME="append(boolean[])"><!-- --></A><H3>
868 append</H3>
869 <PRE>
870 public <A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A> <B>append</B>(boolean[]&nbsp;array)</PRE>
871 <DL>
872 <DD><p>
873 Append a <code>hashCode</code> for a <code>boolean</code> array.
874 </p>
876 <DD><DL>
877 <DT><B>Parameters:</B><DD><CODE>array</CODE> - the array to add to the <code>hashCode</code>
878 <DT><B>Returns:</B><DD>this</DL>
879 </DD>
880 </DL>
881 <HR>
883 <A NAME="append(byte)"><!-- --></A><H3>
884 append</H3>
885 <PRE>
886 public <A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A> <B>append</B>(byte&nbsp;value)</PRE>
887 <DL>
888 <DD><p>
889 Append a <code>hashCode</code> for a <code>byte</code>.
890 </p>
892 <DD><DL>
893 <DT><B>Parameters:</B><DD><CODE>value</CODE> - the byte to add to the <code>hashCode</code>
894 <DT><B>Returns:</B><DD>this</DL>
895 </DD>
896 </DL>
897 <HR>
899 <A NAME="append(byte[])"><!-- --></A><H3>
900 append</H3>
901 <PRE>
902 public <A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A> <B>append</B>(byte[]&nbsp;array)</PRE>
903 <DL>
904 <DD><p>
905 Append a <code>hashCode</code> for a <code>byte</code> array.
906 </p>
908 <DD><DL>
909 <DT><B>Parameters:</B><DD><CODE>array</CODE> - the array to add to the <code>hashCode</code>
910 <DT><B>Returns:</B><DD>this</DL>
911 </DD>
912 </DL>
913 <HR>
915 <A NAME="append(char)"><!-- --></A><H3>
916 append</H3>
917 <PRE>
918 public <A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A> <B>append</B>(char&nbsp;value)</PRE>
919 <DL>
920 <DD><p>
921 Append a <code>hashCode</code> for a <code>char</code>.
922 </p>
924 <DD><DL>
925 <DT><B>Parameters:</B><DD><CODE>value</CODE> - the char to add to the <code>hashCode</code>
926 <DT><B>Returns:</B><DD>this</DL>
927 </DD>
928 </DL>
929 <HR>
931 <A NAME="append(char[])"><!-- --></A><H3>
932 append</H3>
933 <PRE>
934 public <A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A> <B>append</B>(char[]&nbsp;array)</PRE>
935 <DL>
936 <DD><p>
937 Append a <code>hashCode</code> for a <code>char</code> array.
938 </p>
940 <DD><DL>
941 <DT><B>Parameters:</B><DD><CODE>array</CODE> - the array to add to the <code>hashCode</code>
942 <DT><B>Returns:</B><DD>this</DL>
943 </DD>
944 </DL>
945 <HR>
947 <A NAME="append(double)"><!-- --></A><H3>
948 append</H3>
949 <PRE>
950 public <A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A> <B>append</B>(double&nbsp;value)</PRE>
951 <DL>
952 <DD><p>
953 Append a <code>hashCode</code> for a <code>double</code>.
954 </p>
956 <DD><DL>
957 <DT><B>Parameters:</B><DD><CODE>value</CODE> - the double to add to the <code>hashCode</code>
958 <DT><B>Returns:</B><DD>this</DL>
959 </DD>
960 </DL>
961 <HR>
963 <A NAME="append(double[])"><!-- --></A><H3>
964 append</H3>
965 <PRE>
966 public <A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A> <B>append</B>(double[]&nbsp;array)</PRE>
967 <DL>
968 <DD><p>
969 Append a <code>hashCode</code> for a <code>double</code> array.
970 </p>
972 <DD><DL>
973 <DT><B>Parameters:</B><DD><CODE>array</CODE> - the array to add to the <code>hashCode</code>
974 <DT><B>Returns:</B><DD>this</DL>
975 </DD>
976 </DL>
977 <HR>
979 <A NAME="append(float)"><!-- --></A><H3>
980 append</H3>
981 <PRE>
982 public <A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A> <B>append</B>(float&nbsp;value)</PRE>
983 <DL>
984 <DD><p>
985 Append a <code>hashCode</code> for a <code>float</code>.
986 </p>
988 <DD><DL>
989 <DT><B>Parameters:</B><DD><CODE>value</CODE> - the float to add to the <code>hashCode</code>
990 <DT><B>Returns:</B><DD>this</DL>
991 </DD>
992 </DL>
993 <HR>
995 <A NAME="append(float[])"><!-- --></A><H3>
996 append</H3>
997 <PRE>
998 public <A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A> <B>append</B>(float[]&nbsp;array)</PRE>
999 <DL>
1000 <DD><p>
1001 Append a <code>hashCode</code> for a <code>float</code> array.
1002 </p>
1004 <DD><DL>
1005 <DT><B>Parameters:</B><DD><CODE>array</CODE> - the array to add to the <code>hashCode</code>
1006 <DT><B>Returns:</B><DD>this</DL>
1007 </DD>
1008 </DL>
1009 <HR>
1011 <A NAME="append(int)"><!-- --></A><H3>
1012 append</H3>
1013 <PRE>
1014 public <A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A> <B>append</B>(int&nbsp;value)</PRE>
1015 <DL>
1016 <DD><p>
1017 Append a <code>hashCode</code> for an <code>int</code>.
1018 </p>
1020 <DD><DL>
1021 <DT><B>Parameters:</B><DD><CODE>value</CODE> - the int to add to the <code>hashCode</code>
1022 <DT><B>Returns:</B><DD>this</DL>
1023 </DD>
1024 </DL>
1025 <HR>
1027 <A NAME="append(int[])"><!-- --></A><H3>
1028 append</H3>
1029 <PRE>
1030 public <A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A> <B>append</B>(int[]&nbsp;array)</PRE>
1031 <DL>
1032 <DD><p>
1033 Append a <code>hashCode</code> for an <code>int</code> array.
1034 </p>
1036 <DD><DL>
1037 <DT><B>Parameters:</B><DD><CODE>array</CODE> - the array to add to the <code>hashCode</code>
1038 <DT><B>Returns:</B><DD>this</DL>
1039 </DD>
1040 </DL>
1041 <HR>
1043 <A NAME="append(long)"><!-- --></A><H3>
1044 append</H3>
1045 <PRE>
1046 public <A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A> <B>append</B>(long&nbsp;value)</PRE>
1047 <DL>
1048 <DD><p>
1049 Append a <code>hashCode</code> for a <code>long</code>.
1050 </p>
1053 <DD><DL>
1054 <DT><B>Parameters:</B><DD><CODE>value</CODE> - the long to add to the <code>hashCode</code>
1055 <DT><B>Returns:</B><DD>this</DL>
1056 </DD>
1057 </DL>
1058 <HR>
1060 <A NAME="append(long[])"><!-- --></A><H3>
1061 append</H3>
1062 <PRE>
1063 public <A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A> <B>append</B>(long[]&nbsp;array)</PRE>
1064 <DL>
1065 <DD><p>
1066 Append a <code>hashCode</code> for a <code>long</code> array.
1067 </p>
1069 <DD><DL>
1070 <DT><B>Parameters:</B><DD><CODE>array</CODE> - the array to add to the <code>hashCode</code>
1071 <DT><B>Returns:</B><DD>this</DL>
1072 </DD>
1073 </DL>
1074 <HR>
1076 <A NAME="append(java.lang.Object)"><!-- --></A><H3>
1077 append</H3>
1078 <PRE>
1079 public <A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A> <B>append</B>(java.lang.Object&nbsp;object)</PRE>
1080 <DL>
1081 <DD><p>
1082 Append a <code>hashCode</code> for an <code>Object</code>.
1083 </p>
1085 <DD><DL>
1086 <DT><B>Parameters:</B><DD><CODE>object</CODE> - the Object to add to the <code>hashCode</code>
1087 <DT><B>Returns:</B><DD>this</DL>
1088 </DD>
1089 </DL>
1090 <HR>
1092 <A NAME="append(java.lang.Object[])"><!-- --></A><H3>
1093 append</H3>
1094 <PRE>
1095 public <A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A> <B>append</B>(java.lang.Object[]&nbsp;array)</PRE>
1096 <DL>
1097 <DD><p>
1098 Append a <code>hashCode</code> for an <code>Object</code> array.
1099 </p>
1101 <DD><DL>
1102 <DT><B>Parameters:</B><DD><CODE>array</CODE> - the array to add to the <code>hashCode</code>
1103 <DT><B>Returns:</B><DD>this</DL>
1104 </DD>
1105 </DL>
1106 <HR>
1108 <A NAME="append(short)"><!-- --></A><H3>
1109 append</H3>
1110 <PRE>
1111 public <A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A> <B>append</B>(short&nbsp;value)</PRE>
1112 <DL>
1113 <DD><p>
1114 Append a <code>hashCode</code> for a <code>short</code>.
1115 </p>
1117 <DD><DL>
1118 <DT><B>Parameters:</B><DD><CODE>value</CODE> - the short to add to the <code>hashCode</code>
1119 <DT><B>Returns:</B><DD>this</DL>
1120 </DD>
1121 </DL>
1122 <HR>
1124 <A NAME="append(short[])"><!-- --></A><H3>
1125 append</H3>
1126 <PRE>
1127 public <A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A> <B>append</B>(short[]&nbsp;array)</PRE>
1128 <DL>
1129 <DD><p>
1130 Append a <code>hashCode</code> for a <code>short</code> array.
1131 </p>
1133 <DD><DL>
1134 <DT><B>Parameters:</B><DD><CODE>array</CODE> - the array to add to the <code>hashCode</code>
1135 <DT><B>Returns:</B><DD>this</DL>
1136 </DD>
1137 </DL>
1138 <HR>
1140 <A NAME="appendSuper(int)"><!-- --></A><H3>
1141 appendSuper</H3>
1142 <PRE>
1143 public <A HREF="../../../../../org/apache/commons/lang/builder/HashCodeBuilder.html" title="class in org.apache.commons.lang.builder">HashCodeBuilder</A> <B>appendSuper</B>(int&nbsp;superHashCode)</PRE>
1144 <DL>
1145 <DD><p>
1146 Adds the result of super.hashCode() to this builder.
1147 </p>
1149 <DD><DL>
1150 <DT><B>Parameters:</B><DD><CODE>superHashCode</CODE> - the result of calling <code>super.hashCode()</code>
1151 <DT><B>Returns:</B><DD>this HashCodeBuilder, used to chain calls.<DT><B>Since:</B></DT>
1152 <DD>2.0</DD>
1153 </DL>
1154 </DD>
1155 </DL>
1156 <HR>
1158 <A NAME="toHashCode()"><!-- --></A><H3>
1159 toHashCode</H3>
1160 <PRE>
1161 public int <B>toHashCode</B>()</PRE>
1162 <DL>
1163 <DD><p>
1164 Return the computed <code>hashCode</code>.
1165 </p>
1167 <DD><DL>
1169 <DT><B>Returns:</B><DD><code>hashCode</code> based on the fields appended</DL>
1170 </DD>
1171 </DL>
1172 <!-- ========= END OF CLASS DATA ========= -->
1173 <HR>
1176 <!-- ======= START OF BOTTOM NAVBAR ====== -->
1177 <A NAME="navbar_bottom"><!-- --></A>
1178 <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
1179 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
1180 <TR>
1181 <TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
1182 <A NAME="navbar_bottom_firstrow"><!-- --></A>
1183 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
1184 <TR ALIGN="center" VALIGN="top">
1185 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
1186 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
1187 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
1188 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/HashCodeBuilder.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
1189 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
1190 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
1191 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
1192 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
1193 </TR>
1194 </TABLE>
1195 </TD>
1196 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
1197 </EM>
1198 </TD>
1199 </TR>
1201 <TR>
1202 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
1203 &nbsp;<A HREF="../../../../../org/apache/commons/lang/builder/EqualsBuilder.html" title="class in org.apache.commons.lang.builder"><B>PREV CLASS</B></A>&nbsp;
1204 &nbsp;<A HREF="../../../../../org/apache/commons/lang/builder/ReflectionToStringBuilder.html" title="class in org.apache.commons.lang.builder"><B>NEXT CLASS</B></A></FONT></TD>
1205 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
1206 <A HREF="../../../../../index.html" target="_top"><B>FRAMES</B></A> &nbsp;
1207 &nbsp;<A HREF="HashCodeBuilder.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
1208 &nbsp;<SCRIPT type="text/javascript">
1209 <!--
1210 if(window==top) {
1211 document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
1213 //-->
1214 </SCRIPT>
1215 <NOSCRIPT>
1216 <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
1217 </NOSCRIPT>
1219 </FONT></TD>
1220 </TR>
1221 <TR>
1222 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
1223 SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
1224 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
1225 DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
1226 </TR>
1227 </TABLE>
1228 <A NAME="skip-navbar_bottom"></A>
1229 <!-- ======== END OF BOTTOM NAVBAR ======= -->
1231 <HR>
1232 Copyright © 2001-2008 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved.
1233 </BODY>
1234 </HTML>