summaryrefslogtreecommitdiff
path: root/src/main/java/com/stileeducation/markr/dto/SummaryMarksDTO.java
blob: 5c0c2b40f53411bce631894780cfa1b6da8f4769 (plain)
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
50
51
52
53
54
55
56
57
58
59
60
package com.stileeducation.markr.dto;

import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlRootElement;

import java.util.Objects;

@XmlRootElement(name = "summary-marks")
public class SummaryMarksDTO {

  @NotNull(message = "summary-marks available must not be null")
  @Min(value = 0, message = "summary-marks available must be non-negative")
  private Integer available;

  @NotNull(message = "summary-marks obtained must not be null")
  @Min(value = 0, message = "summary-marks obtained must be non-negative")
  private Integer obtained;

  @XmlAttribute(name = "available")
  public int getAvailable() {
    return available;
  }

  public void setAvailable(int available) {
    this.available = available;
  }

  @XmlAttribute(name = "obtained")
  public int getObtained() {
    return obtained;
  }

  public void setObtained(int obtained) {
    this.obtained = obtained;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;
    SummaryMarksDTO that = (SummaryMarksDTO) o;
    return Objects.equals(available, that.available)
        && Objects.equals(obtained, that.obtained);
  }

  @Override
  public int hashCode() {
    return Objects.hash(available, obtained);
  }

  @Override
  public String toString() {
    return "SummaryMarksDTO{" +
        "available=" + available +
        ", obtained=" + obtained +
        '}';
  }
}