11package ru .javawebinar .basejava .model ;
22
3+ import javax .xml .bind .annotation .XmlAccessType ;
4+ import javax .xml .bind .annotation .XmlAccessorType ;
5+ import javax .xml .bind .annotation .XmlRootElement ;
36import java .io .Serializable ;
47import java .util .EnumMap ;
58import java .util .Map ;
69import java .util .Objects ;
710import java .util .UUID ;
811
12+ @ XmlRootElement
13+ @ XmlAccessorType (XmlAccessType .FIELD )
914public class Resume implements Comparable <Resume >, Serializable {
1015 private static final long serialVersionUID = 1L ;
16+
1117 // Unique identifier
12- private final String uuid ;
18+ private String uuid ;
1319
14- private final String fullName ;
20+ private String fullName ;
1521
1622 private final Map <ContactType , String > contacts = new EnumMap <>(ContactType .class );
1723 private final Map <SectionType , Section > sections = new EnumMap <>(SectionType .class );
1824
25+ public Resume () {
26+ }
27+
1928 public Resume (String fullName ) {
2029 this (UUID .randomUUID ().toString (), fullName );
2130 }
@@ -51,19 +60,16 @@ public void addSection(SectionType type, Section section) {
5160 public boolean equals (Object o ) {
5261 if (this == o ) return true ;
5362 if (o == null || getClass () != o .getClass ()) return false ;
54-
5563 Resume resume = (Resume ) o ;
56-
57- if (! uuid .equals (resume .uuid )) return false ;
58- return fullName .equals (resume .fullName );
59-
64+ return Objects . equals ( uuid , resume . uuid ) &&
65+ Objects .equals (fullName , resume .fullName ) &&
66+ Objects .equals (contacts , resume .contacts ) &&
67+ Objects . equals ( sections , resume . sections );
6068 }
6169
6270 @ Override
6371 public int hashCode () {
64- int result = uuid .hashCode ();
65- result = 31 * result + fullName .hashCode ();
66- return result ;
72+ return Objects .hash (uuid , fullName , contacts , sections );
6773 }
6874
6975 @ Override
@@ -76,4 +82,4 @@ public int compareTo(Resume o) {
7682 int cmp = fullName .compareTo (o .fullName );
7783 return cmp != 0 ? cmp : uuid .compareTo (o .uuid );
7884 }
79- }
85+ }
0 commit comments