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

com.wadpam.gaelic.net.NetworkResponse Maven / Gradle / Ivy

The newest version!
/*
 * INSERT COPYRIGHT HERE
 */

package com.wadpam.gaelic.net;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 *
 * @author sosandstrom
 */
public class NetworkResponse {

    private J body;
    private final int code;
    private final Map> headers;
    private final String message;

    public NetworkResponse(int code, Map> headers, String message) {
        this.code = code;
        this.headers = headers;
        this.message = message;
    }

    public J getBody() {
        return body;
    }

    public void setBody(J body) {
        this.body = body;
    }

    public int getCode() {
        return code;
    }

    public String getHeader(String name) {
        if (null == headers) {
            return null;
        }
        
        List values = headers.get(name);
        if (null == values || values.isEmpty()) {
            return null;
        }
        
        return values.get(0);
    }
    
    public Set getHeaderNames() {
        return headers.keySet();
    }

    public Map> getHeaders() {
        return headers;
    }

    public String getMessage() {
        return message;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy