Package com.qq.weixin.sdk.message.handler

Source Code of com.qq.weixin.sdk.message.handler.MessageHandlerLocation

package com.qq.weixin.sdk.message.handler;

import org.w3c.dom.Element;

import com.qq.weixin.sdk.message.Message;
import com.qq.weixin.sdk.message.MessageLocation;
import com.qq.weixin.sdk.message.filter.FilterChain;
import com.qq.weixin.sdk.message.filter.FilterDefaultResult;

/**
* handle location message
*
* @author hujiawei
*
*/
public class MessageHandlerLocation extends MessageHandlerHelper {

  @Override
  public Message handleSpecialMessage(Message message) {
    FilterChain filterChain = new FilterChain();
    filterChain.addFilter(new FilterDefaultResult());// add this,so the next line does not have to verify whether result is null or not
    return filterChain.doFilterChain(message);
  }

  @Override
  protected void parseSpecialMessage(Message message, Element root) {
    MessageLocation messageLocation = (MessageLocation) message;
    messageLocation.setLocationX(root.getElementsByTagName(TAG_LOCATIONX).item(0).getTextContent());
    messageLocation.setLocationY(root.getElementsByTagName(TAG_LOCATIONY).item(0).getTextContent());
    messageLocation.setLabel(root.getElementsByTagName(TAG_LABEL).item(0).getTextContent());
    messageLocation.setScale(root.getElementsByTagName(TAG_SCALE).item(0).getTextContent());
  }

}
TOP

Related Classes of com.qq.weixin.sdk.message.handler.MessageHandlerLocation

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.