com.foxinmy.weixin4j.message.VoiceMessage Maven / Gradle / Ivy
package com.foxinmy.weixin4j.message;
import javax.xml.bind.annotation.XmlElement;
import com.foxinmy.weixin4j.request.WeixinMessage;
import com.foxinmy.weixin4j.type.MessageType;
/**
* 语音消息
*
* 开通语音识别功能,用户每次发送语音给公众号时,微信会在推送的语音消息XML数据包中,赋值到Recongnition字段.
*
*
* @className VoiceMessage
* @author jinyu([email protected])
* @date 2014年4月6日
* @since JDK 1.6
* @see 订阅号、服务号的语音消息
* @see 企业号的语音消息
*/
public class VoiceMessage extends WeixinMessage {
private static final long serialVersionUID = -7988380977182214003L;
public VoiceMessage() {
super(MessageType.voice.name());
}
/**
* 语音消息媒体id,可以调用多媒体文件下载接口拉取数据。
*/
@XmlElement(name = "MediaId")
private String mediaId;
/**
* 语音格式,如amr,speex等
*/
@XmlElement(name = "Format")
private String format;
/**
* 语音识别结果,UTF8编码
*/
@XmlElement(name = "Recognition")
private String recognition;
public String getRecognition() {
return recognition;
}
public String getMediaId() {
return mediaId;
}
public String getFormat() {
return format;
}
@Override
public String toString() {
return "VoiceMessage [mediaId=" + mediaId + ", format=" + format
+ ", recognition=" + recognition + ", " + super.toString()
+ "]";
}
}