Google Directions APIのレスポンスを表すJava class for JSONIC
せっかく書いたんだけど、長めのルートをデコードしようとするとかなりメモリを食うので結局使わなかった
public class GDirection { public static class GRoute { public static class GLeg { public static class GLocation { public double lat; public double lon; } public static class GStep { @JSONHint( name = "travel_mode" ) public String travelMode; @JSONHint( name = "start_location" ) public GLocation startLocation; @JSONHint( name = "end_location" ) public GLocation endLocation; public GPolyLine polyline; public GValue duration; @JSONHint( name = "html_instruction" ) public String htmlInstruction; public GValue distance; } public static class GValue { public long value; public String text; } public GStep[] steps; public GValue duration; public GValue distance; @JSONHint( name = "start_location" ) public GLocation startLocation; @JSONHint( name = "end_location" ) public GLocation endLocation; @JSONHint( name = "start_address" ) public String startAddress; @JSONHint( name = "end_address" ) public String endAddress; } public static class GPolyLine { public String points; public String levels; } @JSONHint( ignore = true ) public String summary; @JSONHint( ignore = true ) public GLeg[] legs; @JSONHint( ignore = true ) public String copyrights; @JSONHint( name = "overview_polyline" ) public GPolyLine overviewPolyline; public String[] warnings; @JSONHint( name = "waypoint_order" ) public int[] waypointOrder; } public String status; public GRoute[] routes; }
あとpolylineのデコーダも書いたけど、既に公開されていそうなのでスルー