package retrofit2; import java.io.IOException; import java.lang.annotation.Annotation; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.Optional; import okhttp3.ResponseBody; import retrofit2.Converter; /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public final class OptionalConverterFactory extends Converter.Factory { static final Converter.Factory INSTANCE = new OptionalConverterFactory(); OptionalConverterFactory() { } @Override // retrofit2.Converter.Factory public final Converter responseBodyConverter(Type type, Annotation[] annotationArr, Retrofit retrofit) { if (getRawType(type) != Optional.class) { return null; } return new OptionalConverter(retrofit.responseBodyConverter(getParameterUpperBound(0, (ParameterizedType) type), annotationArr)); } /* loaded from: classes.dex */ static final class OptionalConverter implements Converter> { final Converter delegate; OptionalConverter(Converter converter) { this.delegate = converter; } @Override // retrofit2.Converter public final Optional convert(ResponseBody responseBody) throws IOException { return Optional.ofNullable(this.delegate.convert(responseBody)); } } }