RecommendationBuilder.java
2.13 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
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
package com.srh.api.builder;
import com.srh.api.model.*;
import java.time.LocalDateTime;
import java.util.List;
public final class RecommendationBuilder {
private Integer id;
private Double weight;
private LocalDateTime date;
private Integer runtimeInSeconds;
private Algorithm algorithm;
private Evaluator evaluator;
private Item item;
private List<RecommendationRating> recommendationRatings;
private RecommendationBuilder() {
}
public static RecommendationBuilder aRecommendation() {
return new RecommendationBuilder();
}
public RecommendationBuilder withId(Integer id) {
this.id = id;
return this;
}
public RecommendationBuilder withWeight(Double weight) {
this.weight = weight;
return this;
}
public RecommendationBuilder withDate(LocalDateTime date) {
this.date = date;
return this;
}
public RecommendationBuilder withRuntimeInSeconds(Integer runtimeInSeconds) {
this.runtimeInSeconds = runtimeInSeconds;
return this;
}
public RecommendationBuilder withAlgorithm(Algorithm algorithm) {
this.algorithm = algorithm;
return this;
}
public RecommendationBuilder withEvaluator(Evaluator evaluator) {
this.evaluator = evaluator;
return this;
}
public RecommendationBuilder withItem(Item item) {
this.item = item;
return this;
}
public RecommendationBuilder withRecommendationRatings(List<RecommendationRating> recommendationRatings) {
this.recommendationRatings = recommendationRatings;
return this;
}
public Recommendation build() {
Recommendation recommendation = new Recommendation();
recommendation.setId(id);
recommendation.setWeight(weight);
recommendation.setDate(date);
recommendation.setRuntimeInSeconds(runtimeInSeconds);
recommendation.setAlgorithm(algorithm);
recommendation.setEvaluator(evaluator);
recommendation.setItem(item);
recommendation.setRecommendationRatings(recommendationRatings);
return recommendation;
}
}