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

io.sphere.sdk.requests.CommandImpl Maven / Gradle / Ivy

package io.sphere.sdk.requests;

import com.fasterxml.jackson.core.type.TypeReference;
import com.google.common.base.Function;
import io.sphere.sdk.models.Base;
import io.sphere.sdk.utils.JsonUtils;

public abstract class CommandImpl extends Base implements Command {
    @Override
    public Function resultMapper() {
        return httpResponse -> JsonUtils.readObjectFromJsonString(typeReference(), httpResponse.getResponseBody());
    }

    protected abstract TypeReference typeReference();
}