Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.51 KB | None | 0 0
  1. package org.example;
  2.  
  3. import com.google.gson.Gson;
  4.  
  5. import java.io.FileNotFoundException;
  6. import java.io.FileReader;
  7. import java.util.Arrays;
  8. import java.util.List;
  9.  
  10. // PolylineOptions.java
  11. // Generated by https://quicktype.io
  12. class PolylineOptions {
  13. private GeocodedWaypoint[] geocodedWaypoints;
  14. private Route[] routes;
  15. private Status status;
  16.  
  17. public GeocodedWaypoint[] getGeocodedWaypoints() { return geocodedWaypoints; }
  18. public void setGeocodedWaypoints(GeocodedWaypoint[] value) { this.geocodedWaypoints = value; }
  19.  
  20. public Route[] getRoutes() { return routes; }
  21. public void setRoutes(Route[] value) { this.routes = value; }
  22.  
  23. public Status getStatus() { return status; }
  24. public void setStatus(Status value) { this.status = value; }
  25.  
  26. @Override
  27. public String toString() {
  28. return "PolylineOptions{" +
  29. "geocodedWaypoints=" + Arrays.toString(geocodedWaypoints) +
  30. ", routes=" + Arrays.toString(routes) +
  31. ", status=" + status +
  32. '}';
  33. }
  34. }
  35.  
  36. // GeocodedWaypoint.java
  37. class GeocodedWaypoint {
  38. private Status geocoderStatus;
  39. private String placeID;
  40. private Type[] types;
  41.  
  42. public Status getGeocoderStatus() { return geocoderStatus; }
  43. public void setGeocoderStatus(Status value) { this.geocoderStatus = value; }
  44.  
  45. public String getPlaceID() { return placeID; }
  46. public void setPlaceID(String value) { this.placeID = value; }
  47.  
  48. public Type[] getTypes() { return types; }
  49. public void setTypes(Type[] value) { this.types = value; }
  50.  
  51. @Override
  52. public String toString() {
  53. return "GeocodedWaypoint{" +
  54. "geocoderStatus=" + geocoderStatus +
  55. ", placeID='" + placeID + '\'' +
  56. ", types=" + Arrays.toString(types) +
  57. '}';
  58. }
  59. }
  60.  
  61. // Status.java
  62. enum Status {
  63. OK;
  64. }
  65.  
  66. // Type.java
  67. enum Type {
  68. ATM, ESTABLISHMENT, FINANCE, POINT_OF_INTEREST;
  69. }
  70.  
  71. // Route.java
  72. class Route {
  73. private Bounds bounds;
  74. private String copyrights;
  75. private Leg[] legs;
  76. private Polyline overviewPolyline;
  77. private String summary;
  78. private Object[] warnings;
  79. private long[] waypointOrder;
  80.  
  81. public Bounds getBounds() { return bounds; }
  82. public void setBounds(Bounds value) { this.bounds = value; }
  83.  
  84. public String getCopyrights() { return copyrights; }
  85. public void setCopyrights(String value) { this.copyrights = value; }
  86.  
  87. public Leg[] getLegs() { return legs; }
  88. public void setLegs(Leg[] value) { this.legs = value; }
  89.  
  90. public Polyline getOverviewPolyline() { return overviewPolyline; }
  91. public void setOverviewPolyline(Polyline value) { this.overviewPolyline = value; }
  92.  
  93. public String getSummary() { return summary; }
  94. public void setSummary(String value) { this.summary = value; }
  95.  
  96. public Object[] getWarnings() { return warnings; }
  97. public void setWarnings(Object[] value) { this.warnings = value; }
  98.  
  99. public long[] getWaypointOrder() { return waypointOrder; }
  100. public void setWaypointOrder(long[] value) { this.waypointOrder = value; }
  101.  
  102. @Override
  103. public String toString() {
  104. return "Route{" +
  105. "bounds=" + bounds +
  106. ", copyrights='" + copyrights + '\'' +
  107. ", legs=" + Arrays.toString(legs) +
  108. ", overviewPolyline=" + overviewPolyline +
  109. ", summary='" + summary + '\'' +
  110. ", warnings=" + Arrays.toString(warnings) +
  111. ", waypointOrder=" + Arrays.toString(waypointOrder) +
  112. '}';
  113. }
  114. }
  115.  
  116. // Bounds.java
  117. class Bounds {
  118. private Northeast northeast;
  119. private Northeast southwest;
  120.  
  121. public Northeast getNortheast() { return northeast; }
  122. public void setNortheast(Northeast value) { this.northeast = value; }
  123.  
  124. public Northeast getSouthwest() { return southwest; }
  125. public void setSouthwest(Northeast value) { this.southwest = value; }
  126.  
  127. @Override
  128. public String toString() {
  129. return "Bounds{" +
  130. "northeast=" + northeast +
  131. ", southwest=" + southwest +
  132. '}';
  133. }
  134. }
  135.  
  136. // Northeast.java
  137. class Northeast {
  138. private double lat;
  139. private double lng;
  140.  
  141. public double getLat() { return lat; }
  142. public void setLat(double value) { this.lat = value; }
  143.  
  144. public double getLng() { return lng; }
  145. public void setLng(double value) { this.lng = value; }
  146.  
  147. @Override
  148. public String toString() {
  149. return "Northeast{" +
  150. "lat=" + lat +
  151. ", lng=" + lng +
  152. '}';
  153. }
  154. }
  155.  
  156. // Leg.java
  157. class Leg {
  158. private Distance distance;
  159. private Distance duration;
  160. private String endAddress;
  161. private Northeast endLocation;
  162. private String startAddress;
  163. private Northeast startLocation;
  164. private Step[] steps;
  165. private Object[] trafficSpeedEntry;
  166. private Object[] viaWaypoint;
  167.  
  168. public Distance getDistance() { return distance; }
  169. public void setDistance(Distance value) { this.distance = value; }
  170.  
  171. public Distance getDuration() { return duration; }
  172. public void setDuration(Distance value) { this.duration = value; }
  173.  
  174. public String getEndAddress() { return endAddress; }
  175. public void setEndAddress(String value) { this.endAddress = value; }
  176.  
  177. public Northeast getEndLocation() { return endLocation; }
  178. public void setEndLocation(Northeast value) { this.endLocation = value; }
  179.  
  180. public String getStartAddress() { return startAddress; }
  181. public void setStartAddress(String value) { this.startAddress = value; }
  182.  
  183. public Northeast getStartLocation() { return startLocation; }
  184. public void setStartLocation(Northeast value) { this.startLocation = value; }
  185.  
  186. public Step[] getSteps() { return steps; }
  187. public void setSteps(Step[] value) { this.steps = value; }
  188.  
  189. public Object[] getTrafficSpeedEntry() { return trafficSpeedEntry; }
  190. public void setTrafficSpeedEntry(Object[] value) { this.trafficSpeedEntry = value; }
  191.  
  192. public Object[] getViaWaypoint() { return viaWaypoint; }
  193. public void setViaWaypoint(Object[] value) { this.viaWaypoint = value; }
  194.  
  195. @Override
  196. public String toString() {
  197. return "Leg{" +
  198. "distance=" + distance +
  199. ", duration=" + duration +
  200. ", endAddress='" + endAddress + '\'' +
  201. ", endLocation=" + endLocation +
  202. ", startAddress='" + startAddress + '\'' +
  203. ", startLocation=" + startLocation +
  204. ", steps=" + Arrays.toString(steps) +
  205. ", trafficSpeedEntry=" + Arrays.toString(trafficSpeedEntry) +
  206. ", viaWaypoint=" + Arrays.toString(viaWaypoint) +
  207. '}';
  208. }
  209. }
  210.  
  211. // Distance.java
  212. class Distance {
  213. private String text;
  214. private long value;
  215.  
  216. public String getText() { return text; }
  217. public void setText(String value) { this.text = value; }
  218.  
  219. public long getValue() { return value; }
  220. public void setValue(long value) { this.value = value; }
  221.  
  222. @Override
  223. public String toString() {
  224. return "Distance{" +
  225. "text='" + text + '\'' +
  226. ", value=" + value +
  227. '}';
  228. }
  229. }
  230.  
  231. // Step.java
  232. class Step {
  233. private Distance distance;
  234. private Distance duration;
  235. private Northeast endLocation;
  236. private String htmlInstructions;
  237. private Polyline polyline;
  238. private Northeast startLocation;
  239. private TravelMode travelMode;
  240. private Maneuver maneuver;
  241.  
  242. public Distance getDistance() { return distance; }
  243. public void setDistance(Distance value) { this.distance = value; }
  244.  
  245. public Distance getDuration() { return duration; }
  246. public void setDuration(Distance value) { this.duration = value; }
  247.  
  248. public Northeast getEndLocation() { return endLocation; }
  249. public void setEndLocation(Northeast value) { this.endLocation = value; }
  250.  
  251. public String getHTMLInstructions() { return htmlInstructions; }
  252. public void setHTMLInstructions(String value) { this.htmlInstructions = value; }
  253.  
  254. public Polyline getPolyline() { return polyline; }
  255. public void setPolyline(Polyline value) { this.polyline = value; }
  256.  
  257. public Northeast getStartLocation() { return startLocation; }
  258. public void setStartLocation(Northeast value) { this.startLocation = value; }
  259.  
  260. public TravelMode getTravelMode() { return travelMode; }
  261. public void setTravelMode(TravelMode value) { this.travelMode = value; }
  262.  
  263. public Maneuver getManeuver() { return maneuver; }
  264. public void setManeuver(Maneuver value) { this.maneuver = value; }
  265.  
  266. @Override
  267. public String toString() {
  268. return "Step{" +
  269. "distance=" + distance +
  270. ", duration=" + duration +
  271. ", endLocation=" + endLocation +
  272. ", htmlInstructions='" + htmlInstructions + '\'' +
  273. ", polyline=" + polyline +
  274. ", startLocation=" + startLocation +
  275. ", travelMode=" + travelMode +
  276. ", maneuver=" + maneuver +
  277. '}';
  278. }
  279. }
  280.  
  281. // Maneuver.java
  282. enum Maneuver {
  283. KEEP_RIGHT, MERGE, ROUNDABOUT_LEFT, STRAIGHT, TURN_LEFT, TURN_RIGHT, TURN_SLIGHT_LEFT;
  284.  
  285. public String toValue() {
  286. switch (this) {
  287. case KEEP_RIGHT: return "keep-right";
  288. case MERGE: return "merge";
  289. case ROUNDABOUT_LEFT: return "roundabout-left";
  290. case STRAIGHT: return "straight";
  291. case TURN_LEFT: return "turn-left";
  292. case TURN_RIGHT: return "turn-right";
  293. case TURN_SLIGHT_LEFT: return "turn-slight-left";
  294. }
  295. return null;
  296. }
  297.  
  298. }
  299.  
  300. // Polyline.java
  301. class Polyline {
  302. private String points;
  303.  
  304. public String getPoints() { return points; }
  305. public void setPoints(String value) { this.points = value; }
  306.  
  307. @Override
  308. public String toString() {
  309. return "Polyline{" +
  310. "points='" + points + '\'' +
  311. '}';
  312. }
  313. }
  314.  
  315. // TravelMode.java
  316. enum TravelMode {
  317. DRIVING;
  318. }
  319.  
  320.  
  321. public class App
  322. {
  323. public static void main( String[] args ) throws FileNotFoundException {
  324. Gson gson = new Gson();
  325. FileReader fileReader = new FileReader("C:\\Users\\KNG HOLDY\\Desktop\\directions.json");
  326. PolylineOptions polylineOptions = gson.fromJson(fileReader, PolylineOptions.class);
  327. System.out.println( polylineOptions.toString());
  328. }
  329. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement