JvmAddress.java

package org.microspace.transport.specific;

import org.microspace.transport.NodeAddress;

/**
 * Address for Jvm Based Transports.
 * 
 * @author Gaspar Sinai - {@literal gaspar.sinai@microspace.org}
 * @version 2016-06-26
 */
public class JvmAddress implements NodeAddress {
	final Integer delegate;
	
	public JvmAddress(Integer delegate) {
		this.delegate = delegate;
	}

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