package org.sonar.plugins.stash.issue;

import org.sonar.api.issue.Issue;
import org.sonar.api.rule.RuleKey;

import java.util.Objects;

public class IssueMetaInformation {
    private String severity;
    private String message;
    private RuleKey rule;

    protected IssueMetaInformation() {}

    public String severity() {
        return severity;
    }

    public String message() {
        return message;
    }

    public RuleKey rule() {
        return rule;
    }

    public static IssueMetaInformation from(Issue issue) {
        IssueMetaInformation imi = new IssueMetaInformation();
        imi.severity = issue.severity();
        imi.message = issue.message();
        imi.rule = issue.ruleKey();
        return imi;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        IssueMetaInformation that = (IssueMetaInformation) o;
        return Objects.equals(severity, that.severity) &&
                Objects.equals(message, that.message) &&
                Objects.equals(rule, that.rule);
    }

    @Override
    public String toString() {
        return severity() + " " + rule() + " " + message();
    }

    @Override
    public int hashCode() {
        return Objects.hash(severity, message, rule);
    }
}

@@ -33,16 +33,179 @@
 issue;%0A%0A
+import static org.apache.commons.lang3.builder.EqualsBuilder.reflectionEquals;%0Aimport static org.apache.commons.lang3.builder.HashCodeBuilder.reflectionHashCode;%0A%0A
 import o
@@ -961,328 +961,127 @@
     
-  if (this == o) return true;%0A        if (o == null %7C%7C getClass() != o.getClass()) return false;%0A        IssueMetaInformation that = (IssueMetaInformation) o
+return reflectionEquals(this, o)
 ;%0A    
+%7D%0A%0A
     
-return Objects.equals(severity, that.severity) &&%0A                Objects.equals(message, that.message) &&%0A                Objects.equals(rule, that.rule
+@Override%0A    public int hashCode() %7B%0A      return reflectionHashCode(this
 );%0A 
@@ -1200,110 +1200,7 @@
    %7D
-%0A%0A    @Override%0A    public int hashCode() %7B%0A        return Objects.hash(severity, message, rule);%0A    %7D
 %0A%7D%0A

use reflection based hashCode and equals