-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResume.java
More file actions
118 lines (95 loc) · 3.23 KB
/
Resume.java
File metadata and controls
118 lines (95 loc) · 3.23 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
package com.learnjava.model;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serial;
import java.io.Serializable;
import java.util.*;
/**
* ru.javawebinar.basejava.model.Resume class
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class Resume implements Comparable<Resume>, Serializable {
@Serial
private static final long serialVersionUID = 1L;
// Unique identifier
private String uuid;
private String fullName;
public static final Resume EMPTY = new Resume();
static {
EMPTY.setSection(SectionType.OBJECTIVE, TextSection.EMPTY);
EMPTY.setSection(SectionType.PERSONAL, TextSection.EMPTY);
EMPTY.setSection(SectionType.ACHIEVEMENT, ListSection.EMPTY);
EMPTY.setSection(SectionType.QUALIFICATIONS, ListSection.EMPTY);
EMPTY.setSection(SectionType.EXPERIENCE, new OrganizationSection(Arrays.asList(Organization.EMPTY)));
EMPTY.setSection(SectionType.EDUCATION, new OrganizationSection(Arrays.asList(Organization.EMPTY)));
}
@SuppressWarnings("FieldMayBeFinal")
private Map<ContactType, String> contacts = new EnumMap<>(ContactType.class);
@SuppressWarnings("FieldMayBeFinal")
private Map<SectionType, Section> sections = new EnumMap<>(SectionType.class);
public Resume(String fullName) {
this(UUID.randomUUID().toString(), fullName);
}
public Resume() {
}
public Resume(String uuid, String fullName) {
this.uuid = uuid;
this.fullName = fullName;
}
public String getFullName() {
return fullName;
}
public Map<ContactType, String> getContacts() {
return contacts;
}
public String getContact(ContactType type) {
return contacts.get(type);
}
public Section getSection(SectionType type) {
return sections.get(type);
}
public Map<SectionType, Section> getSections() {
return sections;
}
public void addContact(ContactType type, String value) {
contacts.put(type, value);
}
public void addSection(SectionType type, Section section) {
sections.put(type, section);
}
public String getUuid() {
return uuid;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Resume resume = (Resume) o;
if (!uuid.equals(resume.uuid)) return false;
return fullName.equals(resume.fullName);
}
@Override
public int hashCode() {
return Objects.hash(this.uuid, this.fullName);
}
@Override
public String toString() {
return uuid + ' ' + fullName;
}
@Override
public int compareTo(Resume o) {
int compareFullName = fullName.compareTo(o.fullName);
return compareFullName == 0 ? uuid.compareTo(o.uuid) : compareFullName;
}
public void setContact(ContactType type, String value) {
contacts.put(type, value);
}
public void setSection(SectionType type, Section section) {
sections.put(type, section);
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
}