當前位置: 首頁>>代碼示例>>Java>>正文


Java Jsons類代碼示例

本文整理匯總了Java中me.hao0.common.json.Jsons的典型用法代碼示例。如果您正苦於以下問題:Java Jsons類的具體用法?Java Jsons怎麽用?Java Jsons使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Jsons類屬於me.hao0.common.json包,在下文中一共展示了Jsons類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: serialize

import me.hao0.common.json.Jsons; //導入依賴的package包/類
@Override
public String serialize(Object o) {
    try {
        return Jsons.DEFAULT.toJson(o);
    } catch (Exception e) {
        log.error("failed to serialize http session {} to json,cause:{}", o, Throwables.getStackTraceAsString(e));
        throw new SerializeException("failed to serialize http session to json", e);
    }
}
 
開發者ID:ihaolin,項目名稱:session,代碼行數:10,代碼來源:JsonSerializer.java

示例2: deserialize

import me.hao0.common.json.Jsons; //導入依賴的package包/類
@Override
public Map<String,Object> deserialize(String o) {
    try {
        return Jsons.DEFAULT.fromJson(o, MAP_TYPE);
    } catch (Exception e) {
        log.error("failed to deserialize string  {} to http session,cause:{} ", o, Throwables.getStackTraceAsString(e));
        throw new SerializeException("failed to deserialize string to http session", e);
    }
}
 
開發者ID:ihaolin,項目名稱:session,代碼行數:10,代碼來源:JsonSerializer.java

示例3: renderCount

import me.hao0.common.json.Jsons; //導入依賴的package包/類
private BillCount renderCount(String countData) {
    // remove first `
    countData = countData.substring(1).replaceAll("\\r", "");
    String[] fieldVals = countData.split(FIELD_SEPARATOR);
    Map<String, Object> billCount = new HashMap<>();
    List<String> fieldNames = BillFields.COUNT;
    for (int i = 0; i<fieldNames.size(); i++){
        billCount.put(fieldNames.get(i), fieldVals[i]);
    }
    return Jsons.DEFAULT.fromJson(Jsons.DEFAULT.toJson(billCount), BillCount.class);
}
 
開發者ID:ihaolin,項目名稱:wepay,代碼行數:12,代碼來源:Bills.java

示例4: renderBill

import me.hao0.common.json.Jsons; //導入依賴的package包/類
private <T extends Bill> T renderBill(String dataLine, List<String> fieldNames, Class<T> billClazz) {
    // remove first `
    dataLine = dataLine.substring(1).replaceAll("\\r", "");
    String[] fieldVals = dataLine.split(FIELD_SEPARATOR);
    Map<String, Object> billData = new HashMap<>();
    for (int i = 0; i<fieldNames.size(); i++){
        billData.put(fieldNames.get(i), fieldVals[i]);
    }
    return Jsons.DEFAULT.fromJson(Jsons.DEFAULT.toJson(billData), billClazz);
}
 
開發者ID:ihaolin,項目名稱:wepay,代碼行數:11,代碼來源:Bills.java

示例5: doHttpsPost

import me.hao0.common.json.Jsons; //導入依賴的package包/類
protected <T> T doHttpsPost(final String url, final Map<String, String> params, Class<T> respClazz){
    String requestBody = Maps.toXml(params);
    String resp = Https.post(url).body(requestBody)
            .ssLSocketFactory(wepay.getSslSocketFactory()).request();
    Map<String, Object> respMap = toMap(resp.replaceAll("(\\r|\\n)", ""));
    if (!doVerifySign(respMap)){
        throw new SignException("微信響應內容簽名非法: " + respMap);
    }
    return Jsons.DEFAULT.fromJson(Jsons.DEFAULT.toJson(respMap), respClazz);
}
 
開發者ID:ihaolin,項目名稱:wepay,代碼行數:11,代碼來源:Component.java

示例6: doQueryOrder

import me.hao0.common.json.Jsons; //導入依賴的package包/類
private WePayOrder doQueryOrder(Map<String, String> queryParams) {
    buildQueryParams(queryParams);
    Map<String, Object> orderData = doPost(ORDER_QUERY, queryParams);
    WePayOrder order = Jsons.DEFAULT.fromJson(Jsons.DEFAULT.toJson(orderData), WePayOrder.class);
    setCoupons(order, orderData);
    return order;
}
 
開發者ID:ihaolin,項目名稱:wepay,代碼行數:8,代碼來源:Orders.java


注:本文中的me.hao0.common.json.Jsons類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。