1 package de.todesbaum.jsite.application.validation;
3 import static java.lang.String.format;
5 import java.util.Arrays;
6 import java.util.Objects;
9 * Container class for a single issue. An issue contains an error key that describes the error,
10 * and a fatality flag that determines whether the insert has to be aborted (if the flag is
11 * {@code true}) or if it can still be performed and only a warning should be generated (if the
12 * flag is {@code false}).
14 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
18 private final String errorKey;
19 private final boolean fatal;
20 private final String[] parameters;
22 Issue(String errorKey, boolean fatal, String... parameters) {
23 this.errorKey = errorKey;
25 this.parameters = parameters;
28 public String getErrorKey() {
32 public boolean isFatal() {
36 public String[] getParameters() {
41 public boolean equals(Object o) {
45 if (o == null || getClass() != o.getClass()) {
48 Issue issue = (Issue) o;
49 return fatal == issue.fatal &&
50 Objects.equals(errorKey, issue.errorKey) &&
51 Arrays.equals(parameters, issue.parameters);
55 public int hashCode() {
56 return Objects.hash(errorKey, fatal, parameters);
60 public String toString() {
61 return format("Issue{errorKey=\"%s\", fatal=%s, parameters=%s}", errorKey, fatal, Arrays.toString(parameters));