Advertisement
Guest User

com.example.model

a guest
Jan 9th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.61 KB | None | 0 0
  1. package com.example.model;
  2.  
  3.  
  4. import javax.persistence.Entity;
  5. import javax.persistence.GeneratedValue;
  6. import javax.persistence.GenerationType;
  7. import javax.persistence.Id;
  8. import javax.validation.constraints.NotEmpty;
  9. import javax.validation.constraints.NotNull;
  10. import javax.validation.constraints.Pattern;
  11. import javax.validation.constraints.Size;
  12.  
  13.  
  14. @Entity
  15. public class User {
  16.  
  17.     @Id
  18.     @GeneratedValue(strategy=GenerationType.AUTO)
  19.     private int id;
  20.     @NotNull
  21.     @NotEmpty(message = "{email.notempty}")
  22.     @Size(min=4, message = "Username should have atleast 4 characters")
  23.     private String username;
  24.     @NotNull
  25.     @NotEmpty(message = "{email.notempty}")
  26.     @Pattern(regexp="([a-zA-Z0-9\\-\\.\\_]+)" + "(\\@)([a-zA-Z0-9\\-\\.]+)" + "(\\.)([a-zA-Z]{2,4})$", message = "Invalid address")
  27.     private String mail;
  28.     @NotNull
  29.     @NotEmpty(message = "{email.notempty}")
  30.     @Size(min=6, message = "Password should have atleast 6 characters")
  31.     private String password;
  32.  
  33.     public User(String username, String mail, String password) {
  34.         super();
  35.         this.username = username;
  36.         this.mail = mail;
  37.         this.password = password;
  38.     }
  39.    
  40.     public User() {};
  41.  
  42.     public int getId() {
  43.         return id;
  44.     }
  45.  
  46.     public void setId(int id) {
  47.         this.id = id;
  48.     }
  49.  
  50.     public String getUsername() {
  51.         return username;
  52.     }
  53.  
  54.     public void setUsername(String username) {
  55.         this.username = username;
  56.     }
  57.  
  58.     public String getMail() {
  59.         return mail;
  60.     }
  61.  
  62.     public void setMail(String mail) {
  63.         this.mail = mail;
  64.     }
  65.  
  66.     public String getPassword() {
  67.         return password;
  68.     }
  69.  
  70.     public void setPassword(String password) {
  71.         this.password = password;
  72.     }
  73.    
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement