eleme.openapi.sdk.oauth.parser.ObjectJsonParser Maven / Gradle / Ivy
package eleme.openapi.sdk.oauth.parser;
import eleme.openapi.sdk.oauth.response.ErrorResponse;
public class ObjectJsonParser implements OAuthParser {
private Class clazz;
private boolean simplify;
public ObjectJsonParser(Class clazz) {
this.clazz = clazz;
}
public ObjectJsonParser(Class clazz, boolean simplify) {
this.clazz = clazz;
this.simplify = simplify;
}
public T parse(String rsp) {
Converter converter;
if (this.simplify) {
converter = new SimplifyJsonConverter();
} else {
converter = new JsonConverter();
}
return converter.toResponse(rsp, clazz);
}
public Class getResponseClass() {
return clazz;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy