Advertisement
Guest User

Untitled

a guest
Sep 15th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.18 KB | None | 0 0
  1. package com.p92.internalcourse2017.gaborbeke.chatwebapp;
  2.  
  3. public class Credentials
  4. {
  5.  
  6.     private String username;
  7.     private String password;
  8.  
  9.     public Credentials(String username, String password)
  10.     {
  11.         this.username = username;
  12.         this.password = password;
  13.  
  14.     }
  15.    
  16.     public Credentials()
  17.     {
  18.        
  19.     }
  20.  
  21.     public String getUsername()
  22.     {
  23.         return username;
  24.     }
  25.  
  26.     public void setUsername(String username)
  27.     {
  28.         this.username = username;
  29.     }
  30.  
  31.     public String getPassword()
  32.     {
  33.         return password;
  34.     }
  35.  
  36.     public void setPassword(String password)
  37.     {
  38.         this.password = password;
  39.     }
  40.  
  41.     @Override
  42.     public int hashCode()
  43.     {
  44.         final int prime = 31;
  45.         int result = 1;
  46.         result = prime * result + ((password == null) ? 0 : password.hashCode());
  47.         result = prime * result + ((username == null) ? 0 : username.hashCode());
  48.         return result;
  49.     }
  50.  
  51.     @Override
  52.     public boolean equals(Object obj)
  53.     {
  54.         if (this == obj)
  55.         {
  56.             return true;
  57.         }
  58.         if (obj == null)
  59.         {
  60.             return false;
  61.         }
  62.         if (this.getClass() != obj.getClass())
  63.         {
  64.             return false;
  65.         }
  66.         Credentials other = (Credentials) obj;
  67.  
  68.         return username.equals(other.username) && password.equals(other.password);
  69.     }
  70.  
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement