Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.example;
- import com.google.gson.Gson;
- import java.io.FileNotFoundException;
- import java.io.FileReader;
- import java.util.Arrays;
- import java.util.List;
- // PolylineOptions.java
- // Generated by https://quicktype.io
- class PolylineOptions {
- private GeocodedWaypoint[] geocodedWaypoints;
- private Route[] routes;
- private Status status;
- public GeocodedWaypoint[] getGeocodedWaypoints() { return geocodedWaypoints; }
- public void setGeocodedWaypoints(GeocodedWaypoint[] value) { this.geocodedWaypoints = value; }
- public Route[] getRoutes() { return routes; }
- public void setRoutes(Route[] value) { this.routes = value; }
- public Status getStatus() { return status; }
- public void setStatus(Status value) { this.status = value; }
- @Override
- public String toString() {
- return "PolylineOptions{" +
- "geocodedWaypoints=" + Arrays.toString(geocodedWaypoints) +
- ", routes=" + Arrays.toString(routes) +
- ", status=" + status +
- '}';
- }
- }
- // GeocodedWaypoint.java
- class GeocodedWaypoint {
- private Status geocoderStatus;
- private String placeID;
- private Type[] types;
- public Status getGeocoderStatus() { return geocoderStatus; }
- public void setGeocoderStatus(Status value) { this.geocoderStatus = value; }
- public String getPlaceID() { return placeID; }
- public void setPlaceID(String value) { this.placeID = value; }
- public Type[] getTypes() { return types; }
- public void setTypes(Type[] value) { this.types = value; }
- @Override
- public String toString() {
- return "GeocodedWaypoint{" +
- "geocoderStatus=" + geocoderStatus +
- ", placeID='" + placeID + '\'' +
- ", types=" + Arrays.toString(types) +
- '}';
- }
- }
- // Status.java
- enum Status {
- OK;
- }
- // Type.java
- enum Type {
- ATM, ESTABLISHMENT, FINANCE, POINT_OF_INTEREST;
- }
- // Route.java
- class Route {
- private Bounds bounds;
- private String copyrights;
- private Leg[] legs;
- private Polyline overviewPolyline;
- private String summary;
- private Object[] warnings;
- private long[] waypointOrder;
- public Bounds getBounds() { return bounds; }
- public void setBounds(Bounds value) { this.bounds = value; }
- public String getCopyrights() { return copyrights; }
- public void setCopyrights(String value) { this.copyrights = value; }
- public Leg[] getLegs() { return legs; }
- public void setLegs(Leg[] value) { this.legs = value; }
- public Polyline getOverviewPolyline() { return overviewPolyline; }
- public void setOverviewPolyline(Polyline value) { this.overviewPolyline = value; }
- public String getSummary() { return summary; }
- public void setSummary(String value) { this.summary = value; }
- public Object[] getWarnings() { return warnings; }
- public void setWarnings(Object[] value) { this.warnings = value; }
- public long[] getWaypointOrder() { return waypointOrder; }
- public void setWaypointOrder(long[] value) { this.waypointOrder = value; }
- @Override
- public String toString() {
- return "Route{" +
- "bounds=" + bounds +
- ", copyrights='" + copyrights + '\'' +
- ", legs=" + Arrays.toString(legs) +
- ", overviewPolyline=" + overviewPolyline +
- ", summary='" + summary + '\'' +
- ", warnings=" + Arrays.toString(warnings) +
- ", waypointOrder=" + Arrays.toString(waypointOrder) +
- '}';
- }
- }
- // Bounds.java
- class Bounds {
- private Northeast northeast;
- private Northeast southwest;
- public Northeast getNortheast() { return northeast; }
- public void setNortheast(Northeast value) { this.northeast = value; }
- public Northeast getSouthwest() { return southwest; }
- public void setSouthwest(Northeast value) { this.southwest = value; }
- @Override
- public String toString() {
- return "Bounds{" +
- "northeast=" + northeast +
- ", southwest=" + southwest +
- '}';
- }
- }
- // Northeast.java
- class Northeast {
- private double lat;
- private double lng;
- public double getLat() { return lat; }
- public void setLat(double value) { this.lat = value; }
- public double getLng() { return lng; }
- public void setLng(double value) { this.lng = value; }
- @Override
- public String toString() {
- return "Northeast{" +
- "lat=" + lat +
- ", lng=" + lng +
- '}';
- }
- }
- // Leg.java
- class Leg {
- private Distance distance;
- private Distance duration;
- private String endAddress;
- private Northeast endLocation;
- private String startAddress;
- private Northeast startLocation;
- private Step[] steps;
- private Object[] trafficSpeedEntry;
- private Object[] viaWaypoint;
- public Distance getDistance() { return distance; }
- public void setDistance(Distance value) { this.distance = value; }
- public Distance getDuration() { return duration; }
- public void setDuration(Distance value) { this.duration = value; }
- public String getEndAddress() { return endAddress; }
- public void setEndAddress(String value) { this.endAddress = value; }
- public Northeast getEndLocation() { return endLocation; }
- public void setEndLocation(Northeast value) { this.endLocation = value; }
- public String getStartAddress() { return startAddress; }
- public void setStartAddress(String value) { this.startAddress = value; }
- public Northeast getStartLocation() { return startLocation; }
- public void setStartLocation(Northeast value) { this.startLocation = value; }
- public Step[] getSteps() { return steps; }
- public void setSteps(Step[] value) { this.steps = value; }
- public Object[] getTrafficSpeedEntry() { return trafficSpeedEntry; }
- public void setTrafficSpeedEntry(Object[] value) { this.trafficSpeedEntry = value; }
- public Object[] getViaWaypoint() { return viaWaypoint; }
- public void setViaWaypoint(Object[] value) { this.viaWaypoint = value; }
- @Override
- public String toString() {
- return "Leg{" +
- "distance=" + distance +
- ", duration=" + duration +
- ", endAddress='" + endAddress + '\'' +
- ", endLocation=" + endLocation +
- ", startAddress='" + startAddress + '\'' +
- ", startLocation=" + startLocation +
- ", steps=" + Arrays.toString(steps) +
- ", trafficSpeedEntry=" + Arrays.toString(trafficSpeedEntry) +
- ", viaWaypoint=" + Arrays.toString(viaWaypoint) +
- '}';
- }
- }
- // Distance.java
- class Distance {
- private String text;
- private long value;
- public String getText() { return text; }
- public void setText(String value) { this.text = value; }
- public long getValue() { return value; }
- public void setValue(long value) { this.value = value; }
- @Override
- public String toString() {
- return "Distance{" +
- "text='" + text + '\'' +
- ", value=" + value +
- '}';
- }
- }
- // Step.java
- class Step {
- private Distance distance;
- private Distance duration;
- private Northeast endLocation;
- private String htmlInstructions;
- private Polyline polyline;
- private Northeast startLocation;
- private TravelMode travelMode;
- private Maneuver maneuver;
- public Distance getDistance() { return distance; }
- public void setDistance(Distance value) { this.distance = value; }
- public Distance getDuration() { return duration; }
- public void setDuration(Distance value) { this.duration = value; }
- public Northeast getEndLocation() { return endLocation; }
- public void setEndLocation(Northeast value) { this.endLocation = value; }
- public String getHTMLInstructions() { return htmlInstructions; }
- public void setHTMLInstructions(String value) { this.htmlInstructions = value; }
- public Polyline getPolyline() { return polyline; }
- public void setPolyline(Polyline value) { this.polyline = value; }
- public Northeast getStartLocation() { return startLocation; }
- public void setStartLocation(Northeast value) { this.startLocation = value; }
- public TravelMode getTravelMode() { return travelMode; }
- public void setTravelMode(TravelMode value) { this.travelMode = value; }
- public Maneuver getManeuver() { return maneuver; }
- public void setManeuver(Maneuver value) { this.maneuver = value; }
- @Override
- public String toString() {
- return "Step{" +
- "distance=" + distance +
- ", duration=" + duration +
- ", endLocation=" + endLocation +
- ", htmlInstructions='" + htmlInstructions + '\'' +
- ", polyline=" + polyline +
- ", startLocation=" + startLocation +
- ", travelMode=" + travelMode +
- ", maneuver=" + maneuver +
- '}';
- }
- }
- // Maneuver.java
- enum Maneuver {
- KEEP_RIGHT, MERGE, ROUNDABOUT_LEFT, STRAIGHT, TURN_LEFT, TURN_RIGHT, TURN_SLIGHT_LEFT;
- public String toValue() {
- switch (this) {
- case KEEP_RIGHT: return "keep-right";
- case MERGE: return "merge";
- case ROUNDABOUT_LEFT: return "roundabout-left";
- case STRAIGHT: return "straight";
- case TURN_LEFT: return "turn-left";
- case TURN_RIGHT: return "turn-right";
- case TURN_SLIGHT_LEFT: return "turn-slight-left";
- }
- return null;
- }
- }
- // Polyline.java
- class Polyline {
- private String points;
- public String getPoints() { return points; }
- public void setPoints(String value) { this.points = value; }
- @Override
- public String toString() {
- return "Polyline{" +
- "points='" + points + '\'' +
- '}';
- }
- }
- // TravelMode.java
- enum TravelMode {
- DRIVING;
- }
- public class App
- {
- public static void main( String[] args ) throws FileNotFoundException {
- Gson gson = new Gson();
- FileReader fileReader = new FileReader("C:\\Users\\KNG HOLDY\\Desktop\\directions.json");
- PolylineOptions polylineOptions = gson.fromJson(fileReader, PolylineOptions.class);
- System.out.println( polylineOptions.toString());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement