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

org.sdn.api.constants.Request Maven / Gradle / Ivy

The newest version!
package org.sdn.api.constants;

import org.sdn.api.request.OpenRequest;

import java.util.HashMap;
import java.util.Map;

/**
 * User: fan
 * Date: 2018/12/04
 * Time: 19:25
 */
public class Request implements OpenRequest {

    private Map params = new HashMap<>();

    private String method = "POST";

    private String requestPath;

    private boolean convert = false;

    @Override
    public boolean getConvert() {
        return this.convert;
    }

    @Override
    public String getApiMethodName() {
        return this.requestPath;
    }

    @Override
    public Class getResponseClass() {
        return Response.class;
    }

    @Override
    public Map getMapParams() {
        return this.params;
    }

    public void setMap(Map map) {
        this.params.putAll(map);
    }

    @Override
    public String getRequestMethod() {
        return this.method;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public void setRequestPath(String requestPath) {
        this.requestPath = requestPath;
    }

    public Request() {
    }

    public Request(String requestPath, Map map) {
        this.params = map;
        this.requestPath = requestPath;
    }

    public Request(String requestPath, String method, Map map) {
        this.params = map;
        this.method = method;
        this.requestPath = requestPath;
    }

    public Request(String requestPath, String method, Map params, Map headers) {
        this.params = params;
        this.method = method;
        this.requestPath = requestPath;
        if (headers != null) {
            this.setHeaderMap(headers);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy