-
Notifications
You must be signed in to change notification settings - Fork 0
/
TripData.java
56 lines (43 loc) · 1.3 KB
/
TripData.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
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import eu.miaplatform.customplugin.springboot.model.*;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"endDate",
"startDate",
"locations"
})
public class TripData {
@JsonProperty("endDate")
public Double endDate;
@JsonProperty("startDate")
public Double startDate;
@JsonProperty("locations")
public List<Location> locations = null;
@Override
public String toString() {
String locationsString = "";
for(Location l : locations) {
locationsString = locationsString + l.toString() + "|";
}
locationsString = locationsString.substring(0, locationsString.length() - 1);
return locationsString;
}
public List<Map<String, Object>> getLocationsAsHashMap() {
return locations
.stream()
.map(location -> location.coordinate)
.map(coordinate -> {
Map<String, Object> map = new HashMap<>();
map.put("location", coordinate);
return map;
})
.collect(Collectors.toList());
}
}