| package com.zt.common.message.handler; | 
|   | 
| import com.zt.common.message.model.Message; | 
| import com.zt.common.message.model.MessageType; | 
| import org.slf4j.Logger; | 
| import org.slf4j.LoggerFactory; | 
|   | 
| import java.io.Serializable; | 
|   | 
| /** | 
|  * 做消息类型的公共逻辑 :如日志等 | 
|  * | 
|  * @author Jeff | 
|  * @param <T> | 
|  */ | 
| public abstract class MessageHandler<T extends Serializable> { | 
|   | 
|     protected static final Logger LOGGER = LoggerFactory.getLogger(MessageHandler.class); | 
|   | 
|     /** | 
|      * 得到消息类型 | 
|      * | 
|      * @return 消息类型 | 
|      */ | 
|     public abstract MessageType getType(); | 
|   | 
|     /** | 
|      * 是否默认选中 | 
|      * | 
|      * @return | 
|      */ | 
|     public boolean getIsDefault() { | 
|         return false; | 
|     } | 
|   | 
|     /** | 
|      * 是否支持 HTML 内容 | 
|      * | 
|      * @return | 
|      */ | 
|     public boolean getSupportHtml() { | 
|         return true; | 
|     } | 
|   | 
|     public boolean handlerMessage(Message<T> message) { | 
|         return sendMessage(message.getData()); | 
|     } | 
|   | 
|     /** | 
|      * 发送消息处理器具体实现 不同消息的发送 | 
|      * | 
|      * @param data | 
|      * @return | 
|      */ | 
|     public abstract boolean sendMessage(T data); | 
|   | 
| } |