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

io.sphere.sdk.models.errors.ErrorResponseImpl Maven / Gradle / Ivy

There is a newer version: 1.0.0-M26
Show newest version
package io.sphere.sdk.models.errors;

import com.fasterxml.jackson.annotation.JsonCreator;
import io.sphere.sdk.models.Base;

import java.util.Collections;
import java.util.List;


final class ErrorResponseImpl extends Base implements ErrorResponse {
    private final Integer statusCode;
    private final String message;
    private final List errors;

    @JsonCreator
    ErrorResponseImpl(final Integer statusCode, final String message, final List errors) {
        this.statusCode = statusCode;
        this.message = message;
        this.errors = errors == null ? Collections.emptyList() : errors;
    }

    @Override
    public Integer getStatusCode() {
        return statusCode;
    }

    /**
     * The message of the first error, for convenience.
     * @return the first error message
     */
    @Override
    public String getMessage() {
        return message;
    }

    @Override
    public List getErrors() {
        return errors;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy