8000 add setters and protected no-arg constructor · prog012/java-design-patterns@f3902ff · GitHub
[go: up one dir, main page]

Skip to content

Commit f3902ff

Browse files
committed
add setters and protected no-arg constructor
1 parent 8208f62 commit f3902ff

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

cqrs/src/main/java/com/iluwatar/cqrs/domain/model/Author.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,42 @@ public Author(String username, String name, String email) {
3232
this.email = email;
3333
}
3434

35-
public Author() {
35+
protected Author() {
3636
super();
3737
}
3838

3939
public long getId() {
4040
return id;
4141
}
4242

43+
public void setId(long id) {
44+
this.id = id;
45+
}
46+
4347
public String getUsername() {
4448
return username;
4549
}
4650

51+
public void setUsername(String username) {
52+
this.username = username;
53+
}
54+
4755
public String getName() {
4856
return name;
4957
}
5058

59+
public void setName(String name) {
60+
this.name = name;
61+
}
62+
5163
public String getEmail() {
5264
return email;
5365
}
5466

67+
public void setEmail(String email) {
68+
this.email = email;
69+
}
70+
5571
@Override
5672
public String toString() {
5773
return "Author [name=" + name + ", email=" + email + "]";

cqrs/src/main/java/com/iluwatar/cqrs/domain/model/Book.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,42 @@ public Book(String title, double price, Author author) {
3434
this.author = author;
3535
}
3636

37-
public Book() {
37+
protected Book() {
3838
super();
3939
}
4040

4141
public long getId() {
4242
return id;
4343
}
4444

45+
public void setId(long id) {
46+
this.id = id;
47+
}
48+
4549
public String getTitle() {
4650
return title;
4751
}
4852

53+
public void setTitle(String title) {
54+
this.title = title;
55+
}
56+
4957
public double getPrice() {
5058
return price;
5159
}
5260

61+
public void setPrice(double price) {
62+
this.price = price;
63+
}
64+
5365
public Author getAuthor() {
5466
return author;
5567
}
5668

69+
public void setAuthor(Author author) {
70+
this.author = author;
71+
}
72+
5773
@Override
5874
public String toString() {
5975
return "Book [title=" + title + ", price=" + price + ", author=" + author + "]";

0 commit comments

Comments
 (0)
0