我正在使用翻新库在'Android App'中使用api进行补全。
现在我有一种方法需要将某些字段删除为可空字段,因此用户可能选择选择此选项以过滤结果或不过滤结果。
@FormUrlEncoded
@POST("filter_products")
Call<Parts> getProducts(@Header("Cookie") String sessionIdAndToken,
@Field("category_id") int category_id);
我需要将category_id设置为可为空的字段。我该怎么做?
@@ Nullable @Field(“ category_id”)int category_id
和
@@ Field(“ category_id”)@Nullable int category_id
确定不正确。.
请问任何治疗?
和谢谢。
int
是原始类型,并且不是可为空的值。使用Integer
代替:
@Nullable @Field("category_id") Integer category_id