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

import fr.adrienbrault.idea.symfony2plugin.routing.dict.RouteInterface;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;

public class StubIndexedRoute implements RouteInterface, Serializable{

    @NotNull
    private final String name;

    @Nullable
    private String controller = null;

    @Nullable
    private String path = null;

    @NotNull
    private Collection<String> methods = new HashSet<String>();

    public StubIndexedRoute(@NotNull String name) {
        this.name = name;
    }

    @Nullable
    public String getController() {
        return controller;
    }

    public void setController(@Nullable String controller) {
        this.controller = controller;
    }

    @NotNull
    public String getName() {
        return name;
    }

    @Nullable
    public String getPath() {
        return path;
    }

    public void setPath(@Nullable String path) {
        this.path = path;
    }

    @NotNull
    public Collection<String> getMethods() {
        return methods;
    }

    public void setMethods(@NotNull Collection<String> methods) {
        this.methods = methods;
    }

    public void addMethod(@NotNull String[] content) {
        this.methods.addAll(Arrays.asList(content));
    }
}
@@ -122,16 +122,72 @@
 erface;%0A
+import org.apache.commons.lang.builder.HashCodeBuilder;%0A
 import o
@@ -372,16 +372,42 @@
 HashSet;
+%0Aimport java.util.Objects;
 %0A%0Apublic
@@ -1502,10 +1502,748 @@
 );%0A    %7D
+%0A%0A    @Override%0A    public int hashCode() %7B%0A        return new HashCodeBuilder()%0A            .append(this.name)%0A            .append(this.controller)%0A            .append(this.path)%0A            .append(new HashSet%3C%3E(this.methods))%0A            .toHashCode()%0A        ;%0A    %7D%0A%0A    @Override%0A    public boolean equals(Object obj) %7B%0A        return obj instanceof RouteInterface &&%0A             Objects.equals(((RouteInterface) obj).getName(), this.name) &&%0A             Objects.equals(((RouteInterface) obj).getController(), this.controller) &&%0A             Objects.equals(((RouteInterface) obj).getPath(), this.path) &&%0A             Objects.equals(new HashSet%3C%3E(((RouteInterface) obj).getMethods()), new HashSet%3C%3E(this.methods))%0A        ;%0A    %7D
 %0A%7D

fix equals / hashCode violation for route index #737