File tree Expand file tree Collapse file tree 2 files changed +69
-0
lines changed
src/main/java/guru/springframework/spring6webapp/domain Expand file tree Collapse file tree 2 files changed +69
-0
lines changed Original file line number Diff line number Diff line change @@ -50,4 +50,40 @@ public String getLastName() {
5050 public void setLastName (String lastName ) {
5151 this .lastName = lastName ;
5252 }
53+
54+ @ Override
55+ public String toString () {
56+ return "Author{" +
57+ "id=" + id +
58+ ", firstName='" + firstName + '\'' +
59+ ", lastName='" + lastName + '\'' +
60+ ", books=" + books +
61+ '}' ;
62+ }
63+
64+ @ Override
65+ public boolean equals (Object o ) {
66+ if (this == o ) return true ;
67+ if (!(o instanceof Author )) return false ;
68+
69+ Author author = (Author ) o ;
70+
71+ return getId () != null ? getId ().equals (author .getId ()) : author .getId () == null ;
72+ }
73+
74+ @ Override
75+ public int hashCode () {
76+ return getId () != null ? getId ().hashCode () : 0 ;
77+ }
5378}
79+
80+
81+
82+
83+
84+
85+
86+
87+
88+
89+
Original file line number Diff line number Diff line change @@ -52,4 +52,37 @@ public String getIsbn() {
5252 public void setIsbn (String isbn ) {
5353 this .isbn = isbn ;
5454 }
55+
56+ @ Override
57+ public String toString () {
58+ return "Book{" +
59+ "id=" + id +
60+ ", title='" + title + '\'' +
61+ ", isbn='" + isbn + '\'' +
62+ ", authors=" + authors +
63+ '}' ;
64+ }
65+
66+ @ Override
67+ public boolean equals (Object o ) {
68+ if (this == o ) return true ;
69+ if (!(o instanceof Book )) return false ;
70+
71+ Book book = (Book ) o ;
72+
73+ return getId () != null ? getId ().equals (book .getId ()) : book .getId () == null ;
74+ }
75+
76+ @ Override
77+ public int hashCode () {
78+ return getId () != null ? getId ().hashCode () : 0 ;
79+ }
5580}
81+
82+
83+
84+
85+
86+
87+
88+
You can’t perform that action at this time.
0 commit comments