-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOrganization.java
More file actions
65 lines (51 loc) · 1.71 KB
/
Organization.java
File metadata and controls
65 lines (51 loc) · 1.71 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
package webapp.model;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import static webapp.model.Section.EMPTY_STRING;
@XmlAccessorType(XmlAccessType.FIELD)
public class Organization implements Serializable {
private static final long serialVersionUID = 1L;
public static final Organization EMPTY = new Organization(EMPTY_STRING, EMPTY_STRING, Position.EMPTY);
// Data structure
private Link homePage;
private List<Position> positions = new ArrayList<>();
public Organization() {
}
public Organization(String name, String url, Position... positions) {
this(new Link(name, url), Arrays.asList(positions));
}
public Organization(Link homePage, List<Position> positions) {
this.homePage = homePage;
this.positions = positions;
}
public Link getHomePage() {
return homePage;
}
public List<Position> getPositions() {
return positions;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Organization)) return false;
Organization that = (Organization) o;
return Objects.equals(homePage, that.homePage) &&
Objects.equals(getPositions(), that.getPositions());
}
@Override
public int hashCode() {
return Objects.hash(getHomePage(), getPositions());
}
@Override
public String toString() {
return "Organization{" +
"homePage=" + homePage +
", positions=" + positions +
'}';
}
}