Use Lombok to declare the JPA required, protected, default, no-arg constructor.

This commit is contained in:
John Blum
2019-10-21 15:28:02 -07:00
parent a4a3c72e82
commit c6e21ffde8

View File

@@ -22,8 +22,10 @@ import javax.persistence.Table;
import org.springframework.data.annotation.Id;
import org.springframework.lang.NonNull;
import lombok.AccessLevel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.RequiredArgsConstructor;
import lombok.ToString;
@@ -42,6 +44,7 @@ import lombok.ToString;
@Table(name = "Contacts")
@ToString(of = "name")
@EqualsAndHashCode(of = "name")
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@RequiredArgsConstructor(staticName = "newContact")
@SuppressWarnings("unused")
public class Contact {
@@ -55,8 +58,6 @@ public class Contact {
@Column(name = "phone_number")
private String phoneNumber;
protected Contact() { }
public Contact withEmailAddress(String emailAddress) {
setEmailAddress(emailAddress);
return this;