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

jp.gopay.sdk.converters.BinaryDataConverterFactory Maven / Gradle / Ivy

package jp.gopay.sdk.converters;

import jp.gopay.sdk.models.response.GoPayBinaryData;
import okhttp3.ResponseBody;
import retrofit2.Converter;
import retrofit2.Retrofit;

import javax.annotation.Nullable;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;

public class BinaryDataConverterFactory extends Converter.Factory{

    @Nullable
    @Override
    public Converter responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit) {

        if(type.equals(GoPayBinaryData.class)){

            return new Converter() {
                @Override
                public GoPayBinaryData convert(ResponseBody responseBody) throws IOException {
                    return new GoPayBinaryData(responseBody.bytes());
                }
            };

        } else return null;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy