CustomAttachConsult.java 1.02 KB
Newer Older
konghaorui committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
package com.yidianling.im.session.extension;

import com.alibaba.fastjson.JSONObject;

/**
 * Created by Wi1ls on 2016/11/28;
 */
public class CustomAttachConsult extends CustomAttachment{
    private final String KEY_URL="url";
    private final String KEY_TITLE="title";

    private String url;
    private String title;

    public CustomAttachConsult() {
        super(CustomAttachmentType.CONSULT);
    }

    public CustomAttachConsult(String url, String title) {
        super(CustomAttachmentType.CONSULT);
        this.url = url;
        this.title = title;
    }

    @Override
    protected void parseData(JSONObject data) {
        this.url=data.getString(KEY_URL);
        this.title=data.getString(KEY_TITLE);
    }

    @Override
    protected JSONObject packData() {
        JSONObject data = new JSONObject();
        data.put(KEY_URL,url);
        data.put(KEY_TITLE, title);
        return data;
    }

    public String getUrl() {
        return url;
    }

    public String getTitle() {
        return title;
    }
}