MCPcopy Create free account
hub / github.com/GuillaumeFalourd/java-training-api / User

Class User

src/main/java/br/com/training/model/User.java:16–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14import org.springframework.stereotype.Component;
15
16@Entity
17public class User implements Serializable {
18
19 private static final long serialVersionUID = 1L;
20
21 @Id
22 @GeneratedValue(strategy = GenerationType.IDENTITY)
23 private Long id;
24
25 @Column(nullable = false)
26 private String name;
27
28 @Column(nullable = false, unique = true)
29 private String email;
30
31 @Column(nullable = false, unique = true)
32 private String cpf;
33
34 @Column(nullable = false)
35 private LocalDate birthDate;
36
37 @Component
38 public class LocalDateSpringConverter implements Converter<String, LocalDate> {
39
40 @Override
41 public LocalDate convert(String value) {
42 if (value != null) {
43 DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
44 return LocalDate.parse(value, formatter);
45 } else {
46 return null;
47 }
48 }
49 }
50
51 public LocalDate getBirthDate() {
52 return birthDate;
53 }
54
55 public void setBirthDate(LocalDate birthDate) {
56 this.birthDate = birthDate;
57 }
58
59 public Long getId() {
60 return id;
61 }
62
63 public void setId(Long id) {
64 this.id = id;
65 }
66
67 public String getName() {
68 return name;
69 }
70
71 public void setName(String name) {
72 this.name = name;
73 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected