Guest User

Untitled

a guest
Jan 28th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.10 KB | None | 0 0
  1. ``` java
  2. package com.example.models;
  3.  
  4.  
  5. import java.io.Serializable;
  6. import java.time.LocalDate;
  7. import java.util.Objects;
  8.  
  9. import javax.persistence.Column;
  10. import javax.persistence.Entity;
  11. import javax.persistence.GeneratedValue;
  12. import javax.persistence.GenerationType;
  13. import javax.persistence.Id;
  14.  
  15. import springfox.documentation.annotations.ApiIgnore;
  16.  
  17. @ApiIgnore
  18. @Entity
  19. public class User implements Serializable {
  20.  
  21. /**
  22. *
  23. */
  24. private static final long serialVersionUID = 6846117438634217888L;
  25.  
  26. @Id
  27. @GeneratedValue(strategy = GenerationType.IDENTITY)
  28. @Column(name = "id")
  29. private Long id;
  30.  
  31. @Column(name = "first_name")
  32. private String firstName;
  33.  
  34. @Column(name = "last_name")
  35. private String lastName;
  36.  
  37. @Column(name = "username")
  38. private String username;
  39.  
  40. @Column(name = "password")
  41. private String password;
  42.  
  43. @Column(name = "age")
  44. private Integer age;
  45.  
  46. @Column(name = "birthDay")
  47. private LocalDate birthDay;
  48.  
  49. public User() {
  50.  
  51. }
  52.  
  53.  
  54.  
  55. public User(Long id, String firstName, String lastName, String username, String password, Integer age, LocalDate birthDay) {
  56. this.id = id;
  57. this.firstName = firstName;
  58. this.lastName = lastName;
  59. this.username = username;
  60. this.password = password;
  61. this.age = age;
  62. this.birthDay = birthDay;
  63. }
  64.  
  65. public Long getId() {
  66. return id;
  67. }
  68.  
  69. public void setId(Long id) {
  70. this.id = id;
  71. }
  72.  
  73. public String getFirstName() {
  74. return firstName;
  75. }
  76.  
  77. public void setFirstName(String firstName) {
  78. this.firstName = firstName;
  79. }
  80.  
  81. public String getLastName() {
  82. return lastName;
  83. }
  84.  
  85. public void setLastName(String lastName) {
  86. this.lastName = lastName;
  87. }
  88.  
  89. public String getUsername() {
  90. return username;
  91. }
  92.  
  93. public void setUsername(String username) {
  94. this.username = username;
  95. }
  96.  
  97. public String getPassword() {
  98. return password;
  99. }
  100.  
  101. public void setPassword(String password) {
  102. this.password = password;
  103. }
  104.  
  105. public Integer getAge() {
  106. return age;
  107. }
  108.  
  109. public void setAge(Integer age) {
  110. this.age = age;
  111. }
  112.  
  113. public LocalDate getBirthDay() {
  114. return birthDay;
  115. }
  116.  
  117. public void setBirthDay(LocalDate birthDay) {
  118. this.birthDay = birthDay;
  119. }
  120.  
  121. @Override
  122. public boolean equals(Object o) {
  123. if (this == o) return true;
  124. if (!(o instanceof User)) return false;
  125. User user = (User) o;
  126. return Objects.equals(getId(), user.getId()) &&
  127. Objects.equals(getUsername(), user.getUsername());
  128. }
  129.  
  130. @Override
  131. public int hashCode() {
  132. return Objects.hash(getId(), getUsername());
  133. }
  134.  
  135. @Override
  136. public String toString() {
  137. return "User{" +
  138. "id=" + id +
  139. ", firstName='" + firstName + '\'' +
  140. ", lastName='" + lastName + '\'' +
  141. ", username='" + username + '\'' +
  142. ", password='" + password + '\'' +
  143. ", age=" + age +
  144. ", birthDay=" + birthDay +
  145. '}';
  146. }
  147. }
  148. '''
Add Comment
Please, Sign In to add comment