001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.util;
016    
017    import com.liferay.portal.kernel.util.HashCode;
018    
019    import org.apache.commons.lang.builder.HashCodeBuilder;
020    
021    /**
022     * @author Brian Wing Shun Chan
023     */
024    public class HashCodeImpl implements HashCode {
025    
026            public HashCodeImpl() {
027                    _hashCodeBuilder = new HashCodeBuilder();
028            }
029    
030            public HashCodeImpl(
031                    int initialNonZeroOddNumber, int multiplierNonZeroOddNumber) {
032    
033                    _hashCodeBuilder = new HashCodeBuilder(
034                            initialNonZeroOddNumber, multiplierNonZeroOddNumber);
035            }
036    
037            public HashCode append(boolean value) {
038                    _hashCodeBuilder.append(value);
039    
040                    return this;
041            }
042    
043            public HashCode append(boolean[] value) {
044                    _hashCodeBuilder.append(value);
045    
046                    return this;
047            }
048    
049            public HashCode append(byte value) {
050                    _hashCodeBuilder.append(value);
051    
052                    return this;
053            }
054    
055            public HashCode append(byte[] value) {
056                    _hashCodeBuilder.append(value);
057    
058                    return this;
059            }
060    
061            public HashCode append(char value) {
062                    _hashCodeBuilder.append(value);
063    
064                    return this;
065            }
066    
067            public HashCode append(char[] value) {
068                    _hashCodeBuilder.append(value);
069    
070                    return this;
071            }
072    
073            public HashCode append(double value) {
074                    _hashCodeBuilder.append(value);
075    
076                    return this;
077            }
078    
079            public HashCode append(double[] value) {
080                    _hashCodeBuilder.append(value);
081    
082                    return this;
083            }
084    
085            public HashCode append(float value) {
086                    _hashCodeBuilder.append(value);
087    
088                    return this;
089            }
090    
091            public HashCode append(float[] value) {
092                    _hashCodeBuilder.append(value);
093    
094                    return this;
095            }
096    
097            public HashCode append(int value) {
098                    _hashCodeBuilder.append(value);
099    
100                    return this;
101            }
102    
103            public HashCode append(int[] value) {
104                    _hashCodeBuilder.append(value);
105    
106                    return this;
107            }
108    
109            public HashCode append(long value) {
110                    _hashCodeBuilder.append(value);
111    
112                    return this;
113            }
114    
115            public HashCode append(long[] value) {
116                    _hashCodeBuilder.append(value);
117    
118                    return this;
119            }
120    
121            public HashCode append(Object value) {
122                    _hashCodeBuilder.append(value);
123    
124                    return this;
125            }
126    
127            public HashCode append(Object[] value) {
128                    _hashCodeBuilder.append(value);
129    
130                    return this;
131            }
132    
133            public HashCode append(short value) {
134                    _hashCodeBuilder.append(value);
135    
136                    return this;
137            }
138    
139            public HashCode append(short[] value) {
140                    _hashCodeBuilder.append(value);
141    
142                    return this;
143            }
144    
145            public HashCode appendSuper(int superHashCode) {
146                    _hashCodeBuilder.appendSuper(superHashCode);
147    
148                    return this;
149            }
150    
151            public int toHashCode() {
152                    return _hashCodeBuilder.toHashCode();
153            }
154    
155            private HashCodeBuilder _hashCodeBuilder;
156    
157    }