package fr.adrienbrault.idea.symfony2plugin.stubs.dict;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.io.Serializable;

/**
 * @author Daniel Espendiller <daniel@espendiller.net>
 */
public class DispatcherEvent implements Serializable {

    @Nullable
    private String fqn;

    @Nullable
    private String instance;

    public DispatcherEvent() {
    }

    public DispatcherEvent(@NotNull String fqn, @Nullable String instance) {
        this.fqn = fqn;
        this.instance = instance;
    }

    @Nullable
    public String getFqn() {
        return fqn;
    }

    @Nullable
    public String getInstance() {
        return instance;
    }
}

package fr.adrienbrault.idea.symfony2plugin.stubs.dict;

import fr.adrienbrault.idea.symfony2plugin.routing.dict.RouteInterface;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Objects;

/**
 * @author Daniel Espendiller <daniel@espendiller.net>
 */
public class DispatcherEvent implements Serializable {

    @Nullable
    private String fqn;

    @Nullable
    private String instance;

    public DispatcherEvent() {
    }

    public DispatcherEvent(@NotNull String fqn, @Nullable String instance) {
        this.fqn = fqn;
        this.instance = instance;
    }

    @Nullable
    public String getFqn() {
        return fqn;
    }

    @Nullable
    public String getInstance() {
        return instance;
    }


    @Override
    public int hashCode() {
        return new HashCodeBuilder()
            .append(this.fqn)
            .append(this.instance)
            .toHashCode()
        ;
    }

    @Override
    public boolean equals(Object obj) {
        return obj instanceof DispatcherEvent &&
            Objects.equals(((DispatcherEvent) obj).fqn, this.fqn) &&
            Objects.equals(((DispatcherEvent) obj).instance, this.instance)
        ;
    }
}

fix equals / hashCode violation for event dispatcher index #737