UserRecallRequestResponse.java 1.25 KB
package com.yoho.search.models.recall;

import com.alibaba.fastjson.JSON;
import com.yoho.search.base.utils.Transfer;
import com.yoho.search.cache.model.AbstractCacheRequestResponse;

public class UserRecallRequestResponse extends AbstractCacheRequestResponse<UserRecallRequest,UserRecallResponse> {

    public UserRecallRequestResponse(UserRecallRequest request) {
        super(request);
    }

    private static Transfer<String,UserRecallResponse> toResponseTransfer = new Transfer<String, UserRecallResponse>() {
        @Override
        public UserRecallResponse transfer(String jsonValue) {
            return JSON.parseObject(jsonValue, UserRecallResponse.class);
        }
    };

    private static Transfer<UserRecallResponse,String> fromResponseTransfer = new Transfer<UserRecallResponse, String>() {
        @Override
        public String transfer(UserRecallResponse userRecallResponse) {
            return JSON.toJSONString(userRecallResponse);
        }
    };

    @Override
    public Transfer<String, UserRecallResponse> getToResponseTransfer() {
        return toResponseTransfer;
    }

    @Override
    public Transfer<UserRecallResponse, String> getFromResponseTransfer() {
        return fromResponseTransfer;
    }
}