mirror of
https://github.com/Akomry/sae302_applicom.git
synced 2025-12-06 11:43:53 +00:00
feat(event): ContactWithEventTest3.java: test passé (2.6.3)
This commit is contained in:
parent
df7442f7a6
commit
8b3a0e5b21
4 changed files with 158 additions and 5 deletions
|
|
@ -1,6 +1,8 @@
|
|||
package rtgre.modeles;
|
||||
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
|
|
@ -101,6 +103,20 @@ public class Contact {
|
|||
return 0;
|
||||
}
|
||||
|
||||
public JSONObject toJsonObject() {
|
||||
return new JSONObject()
|
||||
.put("login", this.login)
|
||||
.put("connected", this.connected);
|
||||
}
|
||||
|
||||
public String toJson() {
|
||||
return toJsonObject().toString();
|
||||
}
|
||||
|
||||
public static Contact fromJSON(JSONObject jsonObject, File banque_avatars) {
|
||||
return new Contact(jsonObject.getString("login"), jsonObject.getBoolean("connected"), banque_avatars);
|
||||
}
|
||||
|
||||
public static BufferedImage avatarFromLogin(File fichier, String login) throws IOException {
|
||||
/**
|
||||
* Renvoie une sous-image en fonction d'une banque d'image et d'un login.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue