Commit cbf770ae authored by Alex Segers's avatar Alex Segers

Add validations and Lombok setters/getters to Student model

parent 1906419c
......@@ -35,6 +35,8 @@ dependencies {
implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap:3.0.2'
implementation "io.springfox:springfox-boot-starter:3.0.0"
compile 'org.json:json:20210307'
annotationProcessor 'org.projectlombok:lombok'
compileOnly 'org.projectlombok:lombok:1.18.16'
}
dependencyManagement {
......
package com.student.details.models;
import lombok.Data;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.time.LocalDate;
@Entity
@Table(name = "student_details")
@Data
public class Student {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
......@@ -14,69 +16,9 @@ public class Student {
@Column(unique = true)
private String email;
private String firstName;
private String lastName;
private LocalDate dateOfBirth;
private String course;
public Student(Long id, String email, String firstName, String lastName, LocalDate dateOfBirth, String course) {
this.id = id;
this.email = email;
this.firstName = firstName;
this.lastName = lastName;
this.dateOfBirth = dateOfBirth;
this.course = course;
}
public Student() {
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
@NotNull
private String firstName, lastName, course;
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public LocalDate getDateOfBirth() {
return dateOfBirth;
}
public void setDateOfBirth(LocalDate dateOfBirth) {
this.dateOfBirth = dateOfBirth;
}
public String getCourse() {
return course;
}
public void setCourse(String course) {
this.course = course;
}
@NotNull
private LocalDate dateOfBirth;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment