Add protected, no-argument, default constructors.
This commit is contained in:
@@ -18,7 +18,9 @@ package example.app.books.model;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.gemfire.mapping.annotation.Region;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@@ -33,6 +35,7 @@ import lombok.RequiredArgsConstructor;
|
||||
*/
|
||||
@Data
|
||||
@Region("Authors")
|
||||
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||
@RequiredArgsConstructor(staticName = "newAuthor")
|
||||
@SuppressWarnings("unused")
|
||||
public class Author {
|
||||
@@ -41,7 +44,7 @@ public class Author {
|
||||
private Long id;
|
||||
|
||||
@NonNull
|
||||
private final String name;
|
||||
private String name;
|
||||
|
||||
public boolean isNew() {
|
||||
return getId() == null;
|
||||
|
||||
@@ -21,7 +21,9 @@ import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
import org.springframework.data.gemfire.mapping.annotation.Region;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@@ -38,6 +40,7 @@ import lombok.RequiredArgsConstructor;
|
||||
*/
|
||||
@Data
|
||||
@Region("Books")
|
||||
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||
@RequiredArgsConstructor(staticName = "newBook")
|
||||
public class Book {
|
||||
|
||||
@@ -49,7 +52,7 @@ public class Book {
|
||||
private LocalDate publishedDate;
|
||||
|
||||
@NonNull
|
||||
private final String title;
|
||||
private String title;
|
||||
|
||||
@Transient
|
||||
public boolean isNew() {
|
||||
|
||||
@@ -42,6 +42,8 @@ public class ISBN implements Comparable<ISBN> {
|
||||
|
||||
private String number;
|
||||
|
||||
protected ISBN() { }
|
||||
|
||||
private ISBN(String number) {
|
||||
this.number = number;
|
||||
}
|
||||
@@ -51,7 +53,6 @@ public class ISBN implements Comparable<ISBN> {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("all")
|
||||
public int compareTo(ISBN other) {
|
||||
return this.getNumber().compareTo(other.getNumber());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user