1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.util;
16  
17  import com.liferay.portal.kernel.util.HashCode;
18  
19  import org.apache.commons.lang.builder.HashCodeBuilder;
20  
21  /**
22   * <a href="HashCodeImpl.java.html"><b><i>View Source</i></b></a>
23   *
24   * @author Brian Wing Shun Chan
25   */
26  public class HashCodeImpl implements HashCode {
27  
28      public HashCodeImpl() {
29          _hashCodeBuilder = new HashCodeBuilder();
30      }
31  
32      public HashCodeImpl(
33          int initialNonZeroOddNumber, int multiplierNonZeroOddNumber) {
34  
35          _hashCodeBuilder = new HashCodeBuilder(
36              initialNonZeroOddNumber, multiplierNonZeroOddNumber);
37      }
38  
39      public HashCode append(boolean value) {
40          _hashCodeBuilder.append(value);
41  
42          return this;
43      }
44  
45      public HashCode append(boolean[] value) {
46          _hashCodeBuilder.append(value);
47  
48          return this;
49      }
50  
51      public HashCode append(byte value) {
52          _hashCodeBuilder.append(value);
53  
54          return this;
55      }
56  
57      public HashCode append(byte[] value) {
58          _hashCodeBuilder.append(value);
59  
60          return this;
61      }
62  
63      public HashCode append(char value) {
64          _hashCodeBuilder.append(value);
65  
66          return this;
67      }
68  
69      public HashCode append(char[] value) {
70          _hashCodeBuilder.append(value);
71  
72          return this;
73      }
74  
75      public HashCode append(double value) {
76          _hashCodeBuilder.append(value);
77  
78          return this;
79      }
80  
81      public HashCode append(double[] value) {
82          _hashCodeBuilder.append(value);
83  
84          return this;
85      }
86  
87      public HashCode append(float value) {
88          _hashCodeBuilder.append(value);
89  
90          return this;
91      }
92  
93      public HashCode append(float[] value) {
94          _hashCodeBuilder.append(value);
95  
96          return this;
97      }
98  
99      public HashCode append(int value) {
100         _hashCodeBuilder.append(value);
101 
102         return this;
103     }
104 
105     public HashCode append(int[] value) {
106         _hashCodeBuilder.append(value);
107 
108         return this;
109     }
110 
111     public HashCode append(long value) {
112         _hashCodeBuilder.append(value);
113 
114         return this;
115     }
116 
117     public HashCode append(long[] value) {
118         _hashCodeBuilder.append(value);
119 
120         return this;
121     }
122 
123     public HashCode append(Object value) {
124         _hashCodeBuilder.append(value);
125 
126         return this;
127     }
128 
129     public HashCode append(Object[] value) {
130         _hashCodeBuilder.append(value);
131 
132         return this;
133     }
134 
135     public HashCode append(short value) {
136         _hashCodeBuilder.append(value);
137 
138         return this;
139     }
140 
141     public HashCode append(short[] value) {
142         _hashCodeBuilder.append(value);
143 
144         return this;
145     }
146 
147     public HashCode appendSuper(int superHashCode) {
148         _hashCodeBuilder.appendSuper(superHashCode);
149 
150         return this;
151     }
152 
153     public int toHashCode() {
154         return _hashCodeBuilder.toHashCode();
155     }
156 
157     private HashCodeBuilder _hashCodeBuilder;
158 
159 }