-
Notifications
You must be signed in to change notification settings - Fork 0
/
Account.java
93 lines (77 loc) · 2.91 KB
/
Account.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package com.company;
import java.util.ArrayList;
import java.util.Collections;
public class Account {
Information information;
ArrayList<Character> characters; //Lista cu toate personajele contului
Integer maps_completed; //Numarul de jocuri jucate
public Account(Information information, ArrayList<Character> characters, Integer maps_completed) {
this.information = information;
this.characters = characters;
this.maps_completed = maps_completed;
}
public static class Information {
private final Credentials credentials; //obligatoriu
private final ArrayList<String> games; //Colectie, jocurile preferate ale jucatorului
private final String name; //Numele jucatorului // obligatoriu
private final String country; //Tara jucatorului
private Information(Builder builder) {
this.credentials = builder.credentials;
this.games = builder.games;
this.name = builder.name;
this.country = builder.country;
}
public ArrayList<String> getGames() {
return games;
}
public Credentials getCredentials() {
return credentials;
}
public String getName() {
return name;
}
public String getCountry() {
return country;
}
@Override
public String toString() {
return "Information{" +
"autentificare=" + credentials +
", jocuri=" + games +
", nume='" + name + '\'' +
", tara='" + country + '\'' +
'}';
}
public static class Builder {
private final Credentials credentials;
private ArrayList<String> games = new ArrayList<>(); // Colectie, jocurile preferate ale jucatorului
private final String name; //Numele jucatorului
private String country; // Tara jucatorului
public Builder(Credentials credentials, String name) {
this.credentials = credentials;
this.name = name;
}
// Campuri optionale
public Builder Games(ArrayList<String> games) {
this.games = games;
Collections.sort(games);
return this;
}
public Builder Country(String country) {
this.country = country;
return this;
}
public Information build() {
return new Information(this);
}
}
}
@Override
public String toString() {
return "Account{" +
"informatii=" + information +
", personaje=" + characters +
", nr_jocuri=" + maps_completed +
'}';
}
}