package fr.adrienbrault.idea.symfony2plugin.dic.container.dict;

import com.intellij.util.containers.HashSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

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

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

    @Nullable
    private String scope;

    @Nullable
    private String name;

    private Collection<String> parameter = new HashSet<>();

    public ContainerBuilderCall() {
    }

    public ContainerBuilderCall(@NotNull String scope) {
        this.scope = scope;
    }

    @Nullable
    public String getScope() {
        return scope;
    }

    public void setScope(@Nullable String scope) {
        this.scope = scope;
    }

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

    public void setName(@Nullable String name) {
        this.name = name;
    }

    @Nullable
    public Collection<String> getParameter() {
        return parameter;
    }

    public void addParameter(@NotNull String parameter) {
        this.parameter.add(parameter);
    }
}

@@ -103,16 +103,72 @@
 ashSet;%0A
+import org.apache.commons.lang.builder.HashCodeBuilder;%0A
 import o
@@ -302,16 +302,42 @@
 lection;
+%0Aimport java.util.Objects;
 %0A%0A/**%0A *
@@ -1242,10 +1242,671 @@
 ;%0A    %7D%0A
+%0A%0A    @Override%0A    public int hashCode() %7B%0A        return new HashCodeBuilder()%0A            .append(this.scope)%0A            .append(this.name)%0A            .append(new java.util.HashSet%3C%3E(this.parameter))%0A            .toHashCode()%0A        ;%0A    %7D%0A%0A    @Override%0A    public boolean equals(Object obj) %7B%0A        return obj instanceof ContainerBuilderCall &&%0A            Objects.equals(((ContainerBuilderCall) obj).scope, this.scope) &&%0A            Objects.equals(((ContainerBuilderCall) obj).name, this.scope) &&%0A            Objects.equals(new java.util.HashSet%3C%3E(((ContainerBuilderCall) obj).parameter), new java.util.HashSet%3C%3E(this.parameter))%0A        ;%0A    %7D%0A%0A
 %7D%0A

fix equals / hashCode violation for container builder index #737