JGroupsNodeAddress.java

package org.microspace.transport.specific;

import org.jgroups.Address;
import org.microspace.transport.NodeAddress;

/**
 * NodeAddress based upon JGroups.
 * 
 * @author Gaspar Sinai - {@literal gaspar.sinai@microspace.org}
 * @version 2016-06-26
 */
public class JGroupsNodeAddress implements NodeAddress {
	final Address delegate;
	
	public JGroupsNodeAddress(Address delegate) {
		this.delegate = delegate;
	}

	public Address getDelegate() {
		return delegate;
	}
	
	@Override
	public int hashCode() {
		return delegate.hashCode();
	}
	
	@Override
	public boolean equals (Object o) {
		if (!(o instanceof JGroupsNodeAddress)) return false;
		JGroupsNodeAddress no = (JGroupsNodeAddress) o;
		return delegate.equals(no.delegate);
	}
	/**
	 * {@inheritDoc}
	 */
	@Override
	public String toString () {
		return delegate.toString();
	}
}