All Downloads are FREE. Search and download functionalities are using the official Maven repository.

tgtools.web.develop.message.ValidMessage Maven / Gradle / Ivy

There is a newer version: 2.0.0
Show newest version
package tgtools.web.develop.message;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import tgtools.exceptions.APPErrorException;
import tgtools.json.JSONObject;
import tgtools.web.develop.util.JsonObjectDeserializer;


/**
 * 通用接口层基础通信json 类型
 *
 * @author 田径
 * @Title
 * @Description
 * @date 12:12
 */
public class ValidMessage {
    private String mToken;
    private String mUser;
    private String mOperation;

    private JSONObject mData;

    public static void main(String[] args) throws APPErrorException {
        String jsonstr="{\"token\": token, \"user\": \"admin\", \"operation\": \"operation1\", \"data\": {\"fda\":\"fdafd\",\"sex\":\"男\",\"my\":true}};";
        JSONObject json =new JSONObject(jsonstr);
        ValidMessage rm = (ValidMessage) tgtools.util.JsonParseHelper.parseToObject(json, ValidMessage.class);
        System.out.println(rm);
    }

    public String getToken() {
        return mToken;
    }

    public void setToken(String pToken) {
        mToken = pToken;
    }

    public String getUser() {
        return mUser;
    }

    public void setUser(String pUser) {
        mUser = pUser;
    }

    public String getOperation() {
        return mOperation;
    }

    public void setOperation(String pOperation) {
        mOperation = pOperation;
    }

    public JSONObject getData() {
        return mData;
    }
    @JsonDeserialize(using = JsonObjectDeserializer.class)
    public void setData(JSONObject pData) {
        this.mData = pData;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy