Guest User

Untitled

a guest
Nov 20th, 2016
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package databaseassignment;
  7.  
  8. public class User {
  9. private int id;
  10. private String username, password;
  11. private boolean admin;
  12.  
  13. public User(int id, String username, String password, boolean admin) {
  14. this.id = id;
  15. this.username = username;
  16. this.password = password;
  17. this.admin = admin;
  18. }
  19.  
  20. public int getId() { return id; }
  21. public String getUsername() { return username; }
  22. public void setUsername(String username) { this.username = username; }
  23. public String getPassword() { return password; }
  24. public void setPassword(String password) { this.password = password; }
  25. public boolean isAdmin() { return admin; }
  26.  
  27. @Override
  28. public String toString() {
  29. return "User{" + "id=" + id + ", username=" + username + ", password=" + password + ", admin=" + admin + '}';
  30. }
  31.  
  32. @Override
  33. public boolean equals(Object obj) {
  34. if (this == obj) {
  35. return true;
  36. }
  37. if (obj == null) {
  38. return false;
  39. }
  40. if (getClass() != obj.getClass()) {
  41. return false;
  42. }
  43. final User other = (User) obj;
  44. if (this.id != other.id) {
  45. return false;
  46. }
  47. return true;
  48. }
  49.  
  50. }
Add Comment
Please, Sign In to add comment