为了发送请求,我需要发送UserlistServiceRequest 一旦我在用户对象中设置数据。 请让我知道如何用这种结构创建UserlistServiceRequest ??
//在此创建用户对象
public static void main(String args[]) {
User user1 = new User();
User user2= new User();
user1.name = "ABC";
user1.age = "28";
user2.name = "XYZ";
user2.age = "38";
}
UserlistServiceRequest.java
public class UserlistServiceRequest {
private String UserlistId;
private Userlists Userlists;
public void setUserlists(Userlists Userlists)
{
this.Userlists = Userlists;
}
public Userlists getUserlists()
{
return Userlists;
}
public void setUserlistId(String UserlistId)
{
this.UserlistId = UserlistId;
}
public String getUserlistId()
{
return UserlistId;
}
}
Userlists.java
public class Userlists implements Serializable {
private Userlist[] Userlist;
public Userlist[] getUserlist() {
return Userlist;
}
public void setUserlist(Userlist[] Userlist) {
this.Userlist = Userlist;
}
}
Userlist.java
public class Userlist implements Serializable
{
private UserlistItem[] UserlistItem;
public UserlistItem[] getUserlistItem()
{
return UserlistItem;
}
public void setUserlistItem(UserlistItem[] UserlistItem)
{
this.UserlistItem = UserlistItem;
}
}
UserlistItem.java
public class UserlistItem implements java.io.Serializable {
private User user;
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
}
User.java
public class User implements Serializable
{
private String name ;
public String getName()
{
return name;
}
public void setSym(String name)
{
this.name = name;
}
}
答案 0 :(得分:0)
这种结构实际上变得非常复杂。
为什么需要创建UserList /
UserListServiceRequestList and so..?? Just User class and
UserServiceRequest`足以满足您的目的。然后您可以在需要时创建相应对象的列表。