com.wei.c.im.test.msg.data.receive.MsgReceived.java Source code

Java tutorial

Introduction

Here is the source code for com.wei.c.im.test.msg.data.receive.MsgReceived.java

Source

/*
 * Copyright (C) 2014 Wei Chou (weichou2010@gmail.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.wei.c.im.test.msg.data.receive;

import org.json.JSONObject;

import com.google.gson.reflect.TypeToken;
import com.wei.c.im.test.msg.data.abs.AbsReceived;

/**
<pre>
{
   //"type": "messages_online", //??
   "ctype": "1", //?
   "cvalue": "?", //?
   //"sendid": "1000000025", //??
   //"sendtype": "user", //????
   "sendtime": 1403862958, //???
   "fromuid": 1000000024 //??
   no?:546154315456
}
</pre>
    
 * @author Wei.Chou
 */
public class MsgReceived extends AbsReceived<MsgReceived> {

    public long fromuid;
    public int ctype;
    public String cvalue;
    public String sendtype = "user";
    public long sendtime;
    public long no;
    public long _order_num;

    @Override
    public boolean isBelongToMe(JSONObject json) {
        return !json.has(KEY_TYPE); //type??type
    }

    @Override
    public MsgReceived fromJson(String json) {
        return fromJsonWithAllFields(json, MsgReceived.class);
    }

    @Override
    protected String[] typeValues() {
        return new String[] {};
    }

    @Override
    protected TypeToken<MsgReceived> getTypeToken() {
        return null;
    }
}