All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.valubio.taobao.api.TaobaoBatchResponse Maven / Gradle / Ivy

The newest version!
package com.valubio.taobao.api;

import java.util.ArrayList;
import java.util.List;

/**
 * 批量API响应类。
 */
public class TaobaoBatchResponse extends TaobaoResponse {

    private static final long serialVersionUID = -3566443848146265580L;

    private List responseList;

    public TaobaoBatchResponse() {
    }

    public TaobaoBatchResponse(String errorCode, String msg) {
        setErrorCode(errorCode);
        setMsg(msg);
    }

    /**
     * 当批量API请求成功后,或获取所有API的响应结果。
     */
    public List getResponseList() {
        return this.responseList;
    }

    public void setResponseList(List responseList) {
        this.responseList = responseList;
    }

    /**
     * 根据指定的API请求获取相应的API响应结果。
     */
    @SuppressWarnings("unchecked")
    public  T getResponse(TaobaoRequest request) {
        if (responseList == null || responseList.isEmpty()) {
            return null;
        }
        return (T) responseList.get(request.getBatchApiOrder());
    }

    public void addResponse(TaobaoResponse response) {
        if (this.responseList == null) {
            this.responseList = new ArrayList();
        }
        this.responseList.add(response);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy