public String toJson ( ) { GsonBuilder gson = new GsonBuilder ( ) ; gson . registerTypeAdapterFactory ( DirectionsAdapterFactory . create ( ) ) ; gson . registerTypeAdapter ( Point . class , new PointAsCoordinatesTypeAdapter ( ) ) ; return gson . create ( ) . toJson ( this ) ; }
This takes the currently defined values found inside this instance and converts it to a json string .