Search in sources :

Example 1 with IfScore

use of com.faendir.zachtronics.bot.inf.model.IfScore in project zachtronics-leaderboard-bot by F43nd1r.

the class IfSolution method unmarshal.

@NotNull
public static IfSolution unmarshal(@NotNull String[] fields) {
    assert fields.length == 4;
    IfScore score = Objects.requireNonNull(IfScore.parseScore(fields[0]));
    String author = fields[1];
    String displayLinks = fields[2];
    String categories = fields[3];
    IfSolution solution = new IfSolution(score, author, List.of(displayLinks.split(",")));
    if (categories != null)
        Pattern.compile(",").splitAsStream(categories).map(IfCategory::valueOf).forEach(solution.categories::add);
    return solution;
}
Also used : IfScore(com.faendir.zachtronics.bot.inf.model.IfScore) IfCategory(com.faendir.zachtronics.bot.inf.model.IfCategory) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

IfCategory (com.faendir.zachtronics.bot.inf.model.IfCategory)1 IfScore (com.faendir.zachtronics.bot.inf.model.IfScore)1 NotNull (org.jetbrains.annotations.NotNull)1