-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathVideoGame.java
More file actions
36 lines (32 loc) · 1.34 KB
/
VideoGame.java
File metadata and controls
36 lines (32 loc) · 1.34 KB
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
package org.example.dto;
import org.apache.commons.collections4.CollectionUtils;
import org.example.utils.TextUtils;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Set;
public record VideoGame(
String title,
String developer,
Set<String> platforms,
Set<Genre> genres,
int estimatedHours,
LocalDate releaseDate,
List<Nomination> nominations,
boolean multiplayer) {
@Override
public String toString() {
if (CollectionUtils.isNotEmpty(this.nominations)) {
this.nominations.sort(new Nomination.NomitationComparator());
}
return "Title: " + this.title
+ "\n\tDeveloper: " + this.developer
+ "\n\tPlatforms: " + TextUtils.getAsPrettyString(this.platforms)
+ "\n\tGenres: " + TextUtils.getAsPrettyString(this.genres)
+ "\n\tEstimated length: " + this.estimatedHours + " hrs"
+ "\n\tRelease date: " + this.releaseDate.format(DateTimeFormatter.ofPattern("dd/MM/yyyy"))
+ "\n\tNominations: " + (CollectionUtils.isEmpty(this.nominations) ? "None" : TextUtils.getAsPrettyListString(this.nominations, 2))
+ "\n\tMultiplayer: " + (this.multiplayer ? "Yes" : "No")
+ "\n";
}
}