-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMatchAssignmentException.java
More file actions
49 lines (40 loc) · 1.17 KB
/
MatchAssignmentException.java
File metadata and controls
49 lines (40 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package cat.udl.eps.softarch.fll.exception;
public class MatchAssignmentException extends RuntimeException {
private final MatchAssignmentErrorCode errorCode;
private final Integer index;
private final String matchId;
private final String refereeId;
public MatchAssignmentException(MatchAssignmentErrorCode errorCode, String message) {
this(errorCode, message, null, null, null);
}
public MatchAssignmentException(
MatchAssignmentErrorCode errorCode,
String message,
Integer index,
String matchId,
String refereeId) {
super(message);
this.errorCode = errorCode;
this.index = index;
this.matchId = index != null ? defaultBatchValue(matchId) : null;
this.refereeId = index != null ? defaultBatchValue(refereeId) : null;
}
public MatchAssignmentErrorCode getErrorCode() {
return errorCode;
}
public Integer getIndex() {
return index;
}
public String getMatchId() {
return matchId;
}
public String getRefereeId() {
return refereeId;
}
public boolean hasBatchDetails() {
return index != null && matchId != null && refereeId != null;
}
private String defaultBatchValue(String value) {
return value != null ? value : "UNKNOWN";
}
}