what-the-bank/sources/retrofit2/converter/simplexml/SimpleXmlConverterFactory.java

62 lines
2.0 KiB
Java

package retrofit2.converter.simplexml;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import org.simpleframework.xml.Serializer;
import org.simpleframework.xml.core.Persister;
import retrofit2.Converter;
import retrofit2.Retrofit;
@Deprecated
/* loaded from: classes.dex */
public final class SimpleXmlConverterFactory extends Converter.Factory {
private final Serializer serializer;
private final boolean strict;
public static SimpleXmlConverterFactory create() {
return create(new Persister());
}
public static SimpleXmlConverterFactory create(Serializer serializer) {
return new SimpleXmlConverterFactory(serializer, true);
}
public static SimpleXmlConverterFactory createNonStrict() {
return createNonStrict(new Persister());
}
public static SimpleXmlConverterFactory createNonStrict(Serializer serializer) {
if (serializer == null) {
throw new NullPointerException("serializer == null");
}
return new SimpleXmlConverterFactory(serializer, false);
}
private SimpleXmlConverterFactory(Serializer serializer, boolean z) {
this.serializer = serializer;
this.strict = z;
}
@Override // retrofit2.Converter.Factory
public final Converter<ResponseBody, ?> responseBodyConverter(Type type, Annotation[] annotationArr, Retrofit retrofit) {
if (type instanceof Class) {
return new SimpleXmlResponseBodyConverter((Class) type, this.serializer, this.strict);
}
return null;
}
@Override // retrofit2.Converter.Factory
public final Converter<?, RequestBody> requestBodyConverter(Type type, Annotation[] annotationArr, Annotation[] annotationArr2, Retrofit retrofit) {
if (type instanceof Class) {
return new SimpleXmlRequestBodyConverter(this.serializer);
}
return null;
}
public final boolean isStrict() {
return this.strict;
}
}