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

net.arccode.wechat.pay.api.common.parser.json.ObjectJsonParser Maven / Gradle / Ivy

The newest version!
package net.arccode.wechat.pay.api.common.parser.json;


import net.arccode.wechat.pay.api.common.exception.WXPayApiException;
import net.arccode.wechat.pay.api.common.parser.Converter;
import net.arccode.wechat.pay.api.protocol.base.WXPayResponse;
import net.arccode.wechat.pay.api.common.parser.WXPayParser;

/**
 * json对象解析器
 *
 * @author http://arccode.net
 * @since 2015-11-06
 */
public class ObjectJsonParser implements WXPayParser {

    private Class clazz;

    public ObjectJsonParser(Class clazz) {
        this.clazz = clazz;
    }

    @Override
    public T parse(String resp) throws WXPayApiException {
        Converter converter = new JsonConverter();
        return converter.toResponse(resp, clazz);
    }

    @Override
    public Class getResponseClass() {
        return clazz;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy