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

de.adorsys.multibanking.ing.model.Response Maven / Gradle / Ivy

There is a newer version: 5.5.34
Show newest version
package de.adorsys.multibanking.ing.model;

import de.adorsys.multibanking.ing.http.ResponseHeaders;

import java.util.function.Function;

public class Response {
    private final int statusCode;
    private final T body;
    private final ResponseHeaders headers;

    public Response(int statusCode, T body, ResponseHeaders headers) {
        this.statusCode = statusCode;
        this.body = body;
        this.headers = headers;
    }

    public int getStatusCode() {
        return statusCode;
    }

    public T getBody() {
        return body;
    }

    public ResponseHeaders getHeaders() {
        return headers;
    }

    public  Response map(Function bodyMapper) {
        return new Response<>(statusCode, bodyMapper.apply(body), headers);
    }
}