Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/339.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/196.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 有没有办法实现下面的JSON pojo类以及如何将数据传递给列表?_Java_Android_Json_Arraylist_Retrofit2 - Fatal编程技术网

Java 有没有办法实现下面的JSON pojo类以及如何将数据传递给列表?

Java 有没有办法实现下面的JSON pojo类以及如何将数据传递给列表?,java,android,json,arraylist,retrofit2,Java,Android,Json,Arraylist,Retrofit2,API调用 @POST("api/CustomerOrder/Post") Call<ResponseBody> postData(@Body Example orderDetail); 如何向所有JSON客户ID添加数据。。。LSCustomerOrderDetails[]? 我正在将数据成功提交到服务器,但数据未存储在数据库中 我还添加了list类,现在我的问题是如何向Model类和list类添加数据?看起来像是私有字符串custId,私有字符串distId应该是整数如果数据成

API调用

@POST("api/CustomerOrder/Post")
Call<ResponseBody> postData(@Body Example orderDetail);
如何向所有JSON客户ID添加数据。。。LSCustomerOrderDetails[]? 我正在将数据成功提交到服务器,但数据未存储在数据库中


我还添加了list类,现在我的问题是如何向Model类和list类添加数据?

看起来像是
私有字符串custId
私有字符串distId
应该是整数如果数据成功地到达服务器,那么您可能需要在server@Omodemilade谢谢你。。。但是我已经调试了代码数据,一切都正常。。告诉我我是否用正确的方式编写代码?请告诉我如何将数据传递给模型类您是否也可以显示这个类
lstcustomerordetail
@DeepakRakh
public类lstcustomerordetail{@SerializedName(“PtypeId”)@Expose private String PtypeId;@SerializedName(“subtypeid”)@Expose private String subtypeid;@SerializedName(“productimgurl”)@Expose private String productimgurl;@SerializedName(“subproductmgurl”)@Expose private String subproductmgurl;@SerializedName(“数量”)@Expose private String Quantity;@SerializedName(“速率”)
和其他添加的feild,我认为这不是问题。你能写一点代码如何向模型类添加数据,并在API调用中列出和集成该类吗
public class Example extends BaseResponse {

@SerializedName("CustId")
@Expose
private String custId;
@SerializedName("distId")
@Expose
private String distId;
@SerializedName("Description")
@Expose
private String description;
@SerializedName("lstCustomerOrderDetails")
@Expose
ArrayList<LstCustomerOrderDetail> orderDetails; //added get set}
mService.postData(exampleResponse)
            .enqueue(new Callback<ResponseBody>() {
                @Override
                public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
                    try {
                        String s =response.body().string();
                        Toast.makeText(ExampleActivity.this, s, Toast.LENGTH_SHORT).show();
                        textView.setText(s);
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }

                @Override
                public void onFailure(Call<ResponseBody> call, Throwable t) {
                    Toast.makeText(ExampleActivity.this, t.getMessage(), Toast.LENGTH_SHORT).show();
                }
            });
public class LstCustomerOrderDetail {
@SerializedName("PtypeId")
@Expose
private String ptypeId;
@SerializedName("SubptypeId")
@Expose
private String subptypeId;
@SerializedName("productimgurl")
@Expose
private String productimgurl;
@SerializedName("subproductimgurl")
@Expose
private String subproductimgurl;
@SerializedName("Quantity")
@Expose
private String quantity;
@SerializedName("Rate")
@Expose
private String rate;
@SerializedName("Totalamount")
@Expose
private String totalamount;
@SerializedName("Paymentmode")
@Expose
private String paymentmode;
@SerializedName("Paymentstatus")
@Expose
private String paymentstatus;