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.cluster;
016    
017    import org.jgroups.Address;
018    
019    /**
020     * @author Shuyang Zhou
021     */
022    public class AddressImpl implements com.liferay.portal.kernel.cluster.Address {
023    
024            public AddressImpl(Address address) {
025                    _address = address;
026            }
027    
028            @Override
029            public boolean equals(Object obj) {
030                    if (this == obj) {
031                            return true;
032                    }
033    
034                    if (!(obj instanceof AddressImpl)) {
035                            return false;
036                    }
037    
038                    AddressImpl addressImpl = (AddressImpl)obj;
039    
040                    if (_address.equals(addressImpl._address)) {
041                            return true;
042                    }
043                    else {
044                            return false;
045                    }
046            }
047    
048            @Override
049            public String getDescription() {
050                    return _address.toString();
051            }
052    
053            @Override
054            public Address getRealAddress() {
055                    return _address;
056            }
057    
058            @Override
059            public int hashCode() {
060                    return _address.hashCode();
061            }
062    
063            @Override
064            public String toString() {
065                    return _address.toString();
066            }
067    
068            private static final long serialVersionUID = 7969878022424426497L;
069    
070            private Address _address;
071    
072    }