com.alipay.api.internal.parser.json.ObjectJsonParser Java Examples

The following examples show how to use com.alipay.api.internal.parser.json.ObjectJsonParser. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractAlipayClient.java    From alipay-sdk-java-all with Apache License 2.0 6 votes vote down vote up
public <T extends AlipayResponse> T execute(AlipayRequest<T> request, String accessToken,
                                            String appAuthToken, String targetAppId) throws AlipayApiException {

    //如果根证书序列号非空,抛异常提示开发者使用certificateExecute
    if (!StringUtils.isEmpty(this.alipayRootCertSN)) {
        throw new AlipayApiException("检测到证书相关参数已初始化,证书模式下请改为调用certificateExecute");
    }

    AlipayParser<T> parser = null;
    if (AlipayConstants.FORMAT_XML.equals(this.format)) {
        parser = new ObjectXmlParser<T>(request.getResponseClass());
    } else {
        parser = new ObjectJsonParser<T>(request.getResponseClass());
    }

    return _execute(request, parser, accessToken, appAuthToken, targetAppId);
}
 
Example #2
Source File: DefaultAlipayClient.java    From alipay-sdk with Apache License 2.0 5 votes vote down vote up
public <T extends AlipayResponse> T execute(AlipayRequest<T> request, String accessToken,
                                            String appAuthToken) throws AlipayApiException {

    AlipayParser<T> parser = null;
    if (AlipayConstants.FORMAT_XML.equals(this.format)) {
        parser = new ObjectXmlParser<T>(request.getResponseClass());
    } else {
        parser = new ObjectJsonParser<T>(request.getResponseClass());
    }

    return _execute(request, parser, accessToken, appAuthToken);
}
 
Example #3
Source File: DefaultAlipayClient.java    From pay with Apache License 2.0 5 votes vote down vote up
public <T extends AlipayResponse> T execute(AlipayRequest<T> request, String accessToken,
                                            String appAuthToken) throws AlipayApiException {

    AlipayParser<T> parser = null;
    if (AlipayConstants.FORMAT_XML.equals(this.format)) {
        parser = new ObjectXmlParser<T>(request.getResponseClass());
    } else {
        parser = new ObjectJsonParser<T>(request.getResponseClass());
    }

    return _execute(request, parser, accessToken, appAuthToken);
}
 
Example #4
Source File: AlipayUtils.java    From pay with Apache License 2.0 4 votes vote down vote up
public static <T extends AlipayResponse> T parseResponse(String json, Class<T> clazz)
                                                                                     throws AlipayApiException {
    ObjectJsonParser<T> parser = new ObjectJsonParser<T>(clazz);
    return parser.parse(json);
}
 
Example #5
Source File: AlipayUtils.java    From alipay-sdk-java-all with Apache License 2.0 2 votes vote down vote up
/**
 * 把JSON字符串解释为对象结构。
 *
 * @param <T>   API响应类型
 * @param json  JSON字符串
 * @param clazz API响应类
 * @return API响应对象
 */
public static <T extends AlipayResponse> T parseResponse(String json, Class<T> clazz)
        throws AlipayApiException {
    ObjectJsonParser<T> parser = new ObjectJsonParser<T>(clazz);
    return parser.parse(json);
}
 
Example #6
Source File: AlipayUtils.java    From alipay-sdk with Apache License 2.0 2 votes vote down vote up
/**
 * 把JSON字符串解释为对象结构。
 * 
 * @param <T> API响应类型
 * @param json JSON字符串
 * @param clazz API响应类
 * @return API响应对象
 */
public static <T extends AlipayResponse> T parseResponse(String json, Class<T> clazz)
                                                                                     throws AlipayApiException {
    ObjectJsonParser<T> parser = new ObjectJsonParser<T>(clazz);
    return parser.parse(json);
}