-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPeriod.java
More file actions
69 lines (57 loc) · 1.91 KB
/
Period.java
File metadata and controls
69 lines (57 loc) · 1.91 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package com.learnjava.model;
import com.learnjava.util.LocalDateAdapter;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.Objects;
@XmlAccessorType(XmlAccessType.FIELD)
public class Period implements Serializable {
@XmlJavaTypeAdapter(LocalDateAdapter.class)
public LocalDate startDate;
@XmlJavaTypeAdapter(LocalDateAdapter.class)
public LocalDate endDate;
public String title;
public String description;
public static final Period EMPTY = new Period();
public Period(LocalDate startDate, LocalDate endDate, String title, String description) {
this.startDate = startDate;
this.endDate = endDate;
this.title = title;
this.description = description;
}
@SuppressWarnings("unused")
public Period() {
}
public LocalDate getStartDate() {
return startDate;
}
public LocalDate getEndDate() {
return endDate;
}
public String getTitle() {
return title;
}
public String getDescription() {
return description;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Period position = (Period) o;
return Objects.equals(startDate, position.startDate) &&
Objects.equals(endDate, position.endDate) &&
Objects.equals(title, position.title) &&
Objects.equals(description, position.description);
}
@Override
public int hashCode() {
return Objects.hash(startDate, endDate, title, description);
}
@Override
public String toString() {
return "Position(" + startDate + ',' + endDate + ',' + title + ',' + description + ')';
}
}