package com.github.aurae.retrofit2;

import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Converter;
import retrofit2.Retrofit;

import java.lang.annotation.Annotation;
import java.lang.reflect.Type;


/**
 * A {@linkplain Converter.Factory converter} which uses LoganSquare for JSON.
 *
 * @see <a>https://github.com/bluelinelabs/LoganSquare</a>
 */
public final class LoganSquareConverterFactory extends Converter.Factory {
    /**
     * Create an instance. Encoding to JSON and decoding from JSON will use UTF-8.
     * @return A {@linkplain Converter.Factory} configured to serve LoganSquare converters
     */
    public static LoganSquareConverterFactory create() {
        return new LoganSquareConverterFactory();
    }

    private LoganSquareConverterFactory() {
    }

    @Override
    public Converter<ResponseBody, ?> responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit) {
        if (!(type instanceof Class)) {
            return null;
        }
        if (!LoganSquare.supports((Class) type)) {
            return null;
        }
        return new LoganSquareResponseBodyConverter(type);
    }

    @Override
    public Converter<?, RequestBody> requestBodyConverter(Type type, Annotation[] parameterAnnotations, Annotation[] methodAnnotations, Retrofit retrofit) {
        if (!(type instanceof Class)) {
            return null;
        }
        if (!LoganSquare.supports((Class) type)) {
            return null;
        }
        return new LoganSquareRequestBodyConverter(type);
    }
}

@@ -931,83 +931,8 @@
 ) %7B%0A
-        if (!(type instanceof Class)) %7B%0A            return null;%0A        %7D%0A
     
@@ -1254,83 +1254,8 @@
 ) %7B%0A
-        if (!(type instanceof Class)) %7B%0A            return null;%0A        %7D%0A
     

Remove class type checks