如何使用 retrofit2 将双打转换为字符串?
How are doubles converted to string with retrofit2?
我们的 api 中有以下方法声明:
Call<WeatherResult> getWeatherPredictions(@Query("lat") double latitude, @Query("lon") double longitude);
现在我们消费的 API 是 "simple",因为当它对给定的纬度或经度不满意时,它只会发回 400
。他们可以很容易地 "patch" 他们的价值观,但他们不会。
我现在的问题是,有人知道double
s是如何被retrofit2转换的吗?我很快查看了源代码,但在那里找不到任何东西。
My question now is, does anybody know how doubles are converted by
retrofit2?
他们正在使用 String#valueOf(Object)
。查询是一个接口。你可以找到它here。文档指出:
Values are converted to strings using {@link String#valueOf(Object)}
and then URL encoded.
我们的 api 中有以下方法声明:
Call<WeatherResult> getWeatherPredictions(@Query("lat") double latitude, @Query("lon") double longitude);
现在我们消费的 API 是 "simple",因为当它对给定的纬度或经度不满意时,它只会发回 400
。他们可以很容易地 "patch" 他们的价值观,但他们不会。
我现在的问题是,有人知道double
s是如何被retrofit2转换的吗?我很快查看了源代码,但在那里找不到任何东西。
My question now is, does anybody know how doubles are converted by retrofit2?
他们正在使用 String#valueOf(Object)
。查询是一个接口。你可以找到它here。文档指出:
Values are converted to strings using {@link String#valueOf(Object)} and then URL encoded.