All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cocaine.message.HandshakeMessage Maven / Gradle / Ivy

There is a newer version: 0.11.1.0
Show newest version
package cocaine.message;

import java.util.UUID;

import com.google.common.base.Preconditions;

/**
 * @author Anton Bobukh 
 */
public final class HandshakeMessage extends Message {

    private final UUID id;

    public HandshakeMessage(UUID id) {
        super(MessageType.HANDSHAKE);
        this.id = Preconditions.checkNotNull(id, "ID can not be null");
    }

    public UUID getId() {
        return id;
    }

    @Override
    public String toString() {
        return "HandshakeMessage/" + getSession() + ": " + id;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        if (!super.equals(o)) {
            return false;
        }

        HandshakeMessage that = (HandshakeMessage) o;
        return id.equals(that.id);
    }

    @Override
    public int hashCode() {
        int result = super.hashCode();
        result = 31 * result + id.hashCode();
        return result;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy