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

com.hn.im.easemob.comm.body.CommandMessageBody Maven / Gradle / Ivy

There is a newer version: 1.0.18
Show newest version
package com.hn.im.easemob.comm.body;

import com.fasterxml.jackson.databind.node.ContainerNode;
import com.hn.im.easemob.comm.constant.MsgType;
import cn.hutool.core.util.StrUtil;

import java.util.Map;

public class CommandMessageBody extends MessageBody {
	private String action;

	public CommandMessageBody(String targetType, String[] targets, String from, Map ext, String action) {
		super(targetType, targets, from, ext);
		this.action = action;
	}

	public String getAction() {
		return action;
	}

	public ContainerNode getBody() {
		if(!this.isInit()){
			this.getMsgBody().put("type", MsgType.CMD);
			this.getMsgBody().put("action", action);
			this.setInit(true);
		}

		return this.getMsgBody();
	}

	@Override
	public Boolean validate() {
		return super.validate() && StrUtil.isNotBlank(action);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy