| 14 | import org.springframework.stereotype.Component; |
| 15 | |
| 16 | @Entity |
| 17 | public 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 | } |
nothing calls this directly
no outgoing calls
no test coverage detected