I need to log the values of each object. The type of object may vary every time, how to use reflection to read all the get methods of the objects.
class Response{
List<OrderStatusList> orderStatusList;
StatusResponse response;
public List<OrderStatusList> getOrderStatusList() {
return orderStatusList;
}
public void setOrderStatusList(List<OrderStatusList> orderStatusList) {
this.orderStatusList = orderStatusList;
}
public StatusResponse getResponse() {
return response;
}
public void setResponse(StatusResponse response) {
this.response = response;
}
}
class StatusResponse{
protected String type;
protected String message;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
class OrderStatusList{
Header header;
public Header getHeader() {
return header;
}
public void setHeader(Header header) {
this.header = header;
}
}
class Header{
protected String orderNumber;
protected String orderStatus;
public String getOrderNumber() {
return orderNumber;
}
public void setOrderNumber(String orderNumber) {
this.orderNumber = orderNumber;
}
public String getOrderStatus() {
return orderStatus;
}
public void setOrderStatus(String orderStatus) {
this.orderStatus = orderStatus;
}
public List<DtOrderStatusResponseList> getItem() {
return item;
}
public void setItem(List<DtOrderStatusResponseList> item) {
this.item = item;
}
protected List<DtOrderStatusResponseList> item;
}
class DtOrderStatusResponseList{
protected String orderItemNumber;
protected String orderItemMaterialNumber;
protected String orderItemRequestedQuantity;
protected String orderItemStatus;
public String getOrderItemNumber() {
return orderItemNumber;
}
public void setOrderItemNumber(String orderItemNumber) {
this.orderItemNumber = orderItemNumber;
}
public String getOrderItemMaterialNumber() {
return orderItemMaterialNumber;
}
public void setOrderItemMaterialNumber(String orderItemMaterialNumber) {
this.orderItemMaterialNumber = orderItemMaterialNumber;
}
public String getOrderItemRequestedQuantity() {
return orderItemRequestedQuantity;
}
public void setOrderItemRequestedQuantity(String orderItemRequestedQuantity)
{
this.orderItemRequestedQuantity = orderItemRequestedQuantity;
}
public String getOrderItemStatus() {
return orderItemStatus;
}
public void setOrderItemStatus(String orderItemStatus) {
this.orderItemStatus = orderItemStatus;
}
Need to deal with many such different objects like Response that i need to iterate, that is why i am looking for a common solution, rather than iterating through each one of these objects.
Aucun commentaire:
Enregistrer un commentaire