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

org.zodiac.monitor.console.event.InstanceEndpointsDetectedEvent Maven / Gradle / Ivy

package org.zodiac.monitor.console.event;

import java.time.Instant;

import org.zodiac.monitor.console.model.Endpoints;

/**
 * This event gets emitted when all instance's endpoints are discovered.
 *
 * @author Johannes Edmeier
 * @author zodiac
 */
public class InstanceEndpointsDetectedEvent extends InstanceEvent {

    private static final long serialVersionUID = -5830993617766872563L;

    private final Endpoints endpoints;

    public InstanceEndpointsDetectedEvent(String instance, long version, Endpoints endpoints) {
        this(instance, version, Instant.now(), endpoints);
    }

    public InstanceEndpointsDetectedEvent(String instance, long version, Instant timestamp, Endpoints endpoints) {
        super(instance, version, "ENDPOINTS_DETECTED", timestamp);
        this.endpoints = endpoints;
    }

    public Endpoints getEndpoints() {
        return endpoints;
    }

    @Override
    public String toString() {
        return "InstanceEndpointsDetectedEvent [endpoints=" + endpoints + ", getInstance()=" + getInstance()
            + ", getVersion()=" + getVersion() + ", getTimestamp()=" + getTimestamp() + ", getType()=" + getType()
            + "]";
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = super.hashCode();
        result = prime * result + ((endpoints == null) ? 0 : endpoints.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (!super.equals(obj))
            return false;
        if (getClass() != obj.getClass())
            return false;
        InstanceEndpointsDetectedEvent other = (InstanceEndpointsDetectedEvent)obj;
        if (endpoints == null) {
            if (other.endpoints != null)
                return false;
        } else if (!endpoints.equals(other.endpoints))
            return false;
        return true;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy