tp 3 / tp 4
This commit is contained in:
48
src/main/java/com/test/beans/User.java
Normal file
48
src/main/java/com/test/beans/User.java
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.test.beans;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author steve.maingana
|
||||
*/
|
||||
public class User {
|
||||
private String pseudo;
|
||||
private String motDePasse;
|
||||
|
||||
public User(String pseudo, String motDePasse) {
|
||||
this.pseudo = pseudo;
|
||||
this.motDePasse = motDePasse;
|
||||
}
|
||||
|
||||
public String getPseudo() {
|
||||
return this.pseudo;
|
||||
}
|
||||
|
||||
private String getMDP() {
|
||||
return this.motDePasse;
|
||||
}
|
||||
|
||||
public void setPseudo(String pseudo) {
|
||||
this.pseudo = pseudo;
|
||||
}
|
||||
|
||||
public void setMDP(String MDP) {
|
||||
this.motDePasse = MDP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object user) {
|
||||
boolean resultat = false;
|
||||
if (user.getClass().equals(this.getClass())) {
|
||||
User toCompare = (User) user;
|
||||
if (this.getPseudo().equals(toCompare.getPseudo()) && this.getMDP().equals(toCompare.getMDP())) {
|
||||
resultat = true;
|
||||
}
|
||||
}
|
||||
|
||||
return resultat;
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user