001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
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            @Override
038            public HashCode append(boolean value) {
039                    _hashCodeBuilder.append(value);
040    
041                    return this;
042            }
043    
044            @Override
045            public HashCode append(boolean[] value) {
046                    _hashCodeBuilder.append(value);
047    
048                    return this;
049            }
050    
051            @Override
052            public HashCode append(byte value) {
053                    _hashCodeBuilder.append(value);
054    
055                    return this;
056            }
057    
058            @Override
059            public HashCode append(byte[] value) {
060                    _hashCodeBuilder.append(value);
061    
062                    return this;
063            }
064    
065            @Override
066            public HashCode append(char value) {
067                    _hashCodeBuilder.append(value);
068    
069                    return this;
070            }
071    
072            @Override
073            public HashCode append(char[] value) {
074                    _hashCodeBuilder.append(value);
075    
076                    return this;
077            }
078    
079            @Override
080            public HashCode append(double value) {
081                    _hashCodeBuilder.append(value);
082    
083                    return this;
084            }
085    
086            @Override
087            public HashCode append(double[] value) {
088                    _hashCodeBuilder.append(value);
089    
090                    return this;
091            }
092    
093            @Override
094            public HashCode append(float value) {
095                    _hashCodeBuilder.append(value);
096    
097                    return this;
098            }
099    
100            @Override
101            public HashCode append(float[] value) {
102                    _hashCodeBuilder.append(value);
103    
104                    return this;
105            }
106    
107            @Override
108            public HashCode append(int value) {
109                    _hashCodeBuilder.append(value);
110    
111                    return this;
112            }
113    
114            @Override
115            public HashCode append(int[] value) {
116                    _hashCodeBuilder.append(value);
117    
118                    return this;
119            }
120    
121            @Override
122            public HashCode append(long value) {
123                    _hashCodeBuilder.append(value);
124    
125                    return this;
126            }
127    
128            @Override
129            public HashCode append(long[] value) {
130                    _hashCodeBuilder.append(value);
131    
132                    return this;
133            }
134    
135            @Override
136            public HashCode append(Object value) {
137                    _hashCodeBuilder.append(value);
138    
139                    return this;
140            }
141    
142            @Override
143            public HashCode append(Object[] value) {
144                    _hashCodeBuilder.append(value);
145    
146                    return this;
147            }
148    
149            @Override
150            public HashCode append(short value) {
151                    _hashCodeBuilder.append(value);
152    
153                    return this;
154            }
155    
156            @Override
157            public HashCode append(short[] value) {
158                    _hashCodeBuilder.append(value);
159    
160                    return this;
161            }
162    
163            @Override
164            public HashCode appendSuper(int superHashCode) {
165                    _hashCodeBuilder.appendSuper(superHashCode);
166    
167                    return this;
168            }
169    
170            @Override
171            public int toHashCode() {
172                    return _hashCodeBuilder.toHashCode();
173            }
174    
175            private HashCodeBuilder _hashCodeBuilder;
176    
177    }