mirror of
				https://gitee.com/binary/weixin-java-tools.git
				synced 2025-10-31 18:46:10 +08:00 
			
		
		
		
	parameterized some generic types
This commit is contained in:
		| @ -1,18 +1,5 @@ | |||||||
| package me.chanjar.weixin.mp.api; | package me.chanjar.weixin.mp.api; | ||||||
|  |  | ||||||
| import me.chanjar.weixin.common.session.InternalSession; |  | ||||||
| import me.chanjar.weixin.common.session.InternalSessionManager; |  | ||||||
| import me.chanjar.weixin.common.session.StandardSessionManager; |  | ||||||
| import me.chanjar.weixin.common.session.WxSessionManager; |  | ||||||
| import me.chanjar.weixin.common.util.LogExceptionHandler; |  | ||||||
| import me.chanjar.weixin.common.api.WxErrorExceptionHandler; |  | ||||||
| import me.chanjar.weixin.common.api.WxMessageDuplicateChecker; |  | ||||||
| import me.chanjar.weixin.common.api.WxMessageInMemoryDuplicateChecker; |  | ||||||
| import me.chanjar.weixin.mp.bean.WxMpXmlMessage; |  | ||||||
| import me.chanjar.weixin.mp.bean.WxMpXmlOutMessage; |  | ||||||
| import org.slf4j.Logger; |  | ||||||
| import org.slf4j.LoggerFactory; |  | ||||||
|  |  | ||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| import java.util.concurrent.ExecutionException; | import java.util.concurrent.ExecutionException; | ||||||
| @ -20,6 +7,20 @@ import java.util.concurrent.ExecutorService; | |||||||
| import java.util.concurrent.Executors; | import java.util.concurrent.Executors; | ||||||
| import java.util.concurrent.Future; | import java.util.concurrent.Future; | ||||||
|  |  | ||||||
|  | import org.slf4j.Logger; | ||||||
|  | import org.slf4j.LoggerFactory; | ||||||
|  |  | ||||||
|  | import me.chanjar.weixin.common.api.WxErrorExceptionHandler; | ||||||
|  | import me.chanjar.weixin.common.api.WxMessageDuplicateChecker; | ||||||
|  | import me.chanjar.weixin.common.api.WxMessageInMemoryDuplicateChecker; | ||||||
|  | import me.chanjar.weixin.common.session.InternalSession; | ||||||
|  | import me.chanjar.weixin.common.session.InternalSessionManager; | ||||||
|  | import me.chanjar.weixin.common.session.StandardSessionManager; | ||||||
|  | import me.chanjar.weixin.common.session.WxSessionManager; | ||||||
|  | import me.chanjar.weixin.common.util.LogExceptionHandler; | ||||||
|  | import me.chanjar.weixin.mp.bean.WxMpXmlMessage; | ||||||
|  | import me.chanjar.weixin.mp.bean.WxMpXmlOutMessage; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * <pre> |  * <pre> | ||||||
|  * 微信消息路由器,通过代码化的配置,把来自微信的消息交给handler处理 |  * 微信消息路由器,通过代码化的配置,把来自微信的消息交给handler处理 | ||||||
| @ -155,7 +156,7 @@ public class WxMpMessageRouter { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     WxMpXmlOutMessage res = null; |     WxMpXmlOutMessage res = null; | ||||||
|     final List<Future> futures = new ArrayList<>(); |     final List<Future<?>> futures = new ArrayList<>(); | ||||||
|     for (final WxMpMessageRouterRule rule : matchRules) { |     for (final WxMpMessageRouterRule rule : matchRules) { | ||||||
|       // 返回最后一个非异步的rule的执行结果 |       // 返回最后一个非异步的rule的执行结果 | ||||||
|       if(rule.isAsync()) { |       if(rule.isAsync()) { | ||||||
| @ -179,7 +180,7 @@ public class WxMpMessageRouter { | |||||||
|       this.executorService.submit(new Runnable() { |       this.executorService.submit(new Runnable() { | ||||||
|         @Override |         @Override | ||||||
|         public void run() { |         public void run() { | ||||||
|           for (Future future : futures) { |           for (Future<?> future : futures) { | ||||||
|             try { |             try { | ||||||
|               future.get(); |               future.get(); | ||||||
|               WxMpMessageRouter.this.log.debug("End session access: async=true, sessionId={}", wxMessage.getFromUserName()); |               WxMpMessageRouter.this.log.debug("End session access: async=true, sessionId={}", wxMessage.getFromUserName()); | ||||||
|  | |||||||
| @ -1,16 +1,25 @@ | |||||||
| package me.chanjar.weixin.mp.util.xml; | package me.chanjar.weixin.mp.util.xml; | ||||||
|  |  | ||||||
| import com.thoughtworks.xstream.XStream; |  | ||||||
| import me.chanjar.weixin.common.util.xml.XStreamInitializer; |  | ||||||
| import me.chanjar.weixin.mp.bean.*; |  | ||||||
|  |  | ||||||
| import java.io.InputStream; | import java.io.InputStream; | ||||||
| import java.util.HashMap; | import java.util.HashMap; | ||||||
| import java.util.Map; | import java.util.Map; | ||||||
|  |  | ||||||
|  | import com.thoughtworks.xstream.XStream; | ||||||
|  |  | ||||||
|  | import me.chanjar.weixin.common.util.xml.XStreamInitializer; | ||||||
|  | import me.chanjar.weixin.mp.bean.WxMpXmlMessage; | ||||||
|  | import me.chanjar.weixin.mp.bean.WxMpXmlOutImageMessage; | ||||||
|  | import me.chanjar.weixin.mp.bean.WxMpXmlOutMessage; | ||||||
|  | import me.chanjar.weixin.mp.bean.WxMpXmlOutMusicMessage; | ||||||
|  | import me.chanjar.weixin.mp.bean.WxMpXmlOutNewsMessage; | ||||||
|  | import me.chanjar.weixin.mp.bean.WxMpXmlOutTextMessage; | ||||||
|  | import me.chanjar.weixin.mp.bean.WxMpXmlOutTransferCustomerServiceMessage; | ||||||
|  | import me.chanjar.weixin.mp.bean.WxMpXmlOutVideoMessage; | ||||||
|  | import me.chanjar.weixin.mp.bean.WxMpXmlOutVoiceMessage; | ||||||
|  |  | ||||||
| public class XStreamTransformer { | public class XStreamTransformer { | ||||||
|  |  | ||||||
|   protected static final Map<Class, XStream> CLASS_2_XSTREAM_INSTANCE = configXStreamInstance(); |   protected static final Map<Class<?>, XStream> CLASS_2_XSTREAM_INSTANCE = configXStreamInstance(); | ||||||
|  |  | ||||||
|   /** |   /** | ||||||
|    * xml -> pojo |    * xml -> pojo | ||||||
| @ -32,7 +41,7 @@ public class XStreamTransformer { | |||||||
|    * @param clz 类型 |    * @param clz 类型 | ||||||
|    * @param xStream xml解析器 |    * @param xStream xml解析器 | ||||||
|    */ |    */ | ||||||
|   public static void register(Class clz,XStream xStream){ |   public static void register(Class<?> clz, XStream xStream) { | ||||||
|     CLASS_2_XSTREAM_INSTANCE.put(clz,xStream); |     CLASS_2_XSTREAM_INSTANCE.put(clz,xStream); | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @ -44,8 +53,8 @@ public class XStreamTransformer { | |||||||
|     return CLASS_2_XSTREAM_INSTANCE.get(clazz).toXML(object); |     return CLASS_2_XSTREAM_INSTANCE.get(clazz).toXML(object); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   private static Map<Class, XStream> configXStreamInstance() { |   private static Map<Class<?>, XStream> configXStreamInstance() { | ||||||
|     Map<Class, XStream> map = new HashMap<>(); |     Map<Class<?>, XStream> map = new HashMap<>(); | ||||||
|     map.put(WxMpXmlMessage.class, config_WxMpXmlMessage()); |     map.put(WxMpXmlMessage.class, config_WxMpXmlMessage()); | ||||||
|     map.put(WxMpXmlOutMusicMessage.class, config_WxMpXmlOutMusicMessage()); |     map.put(WxMpXmlOutMusicMessage.class, config_WxMpXmlOutMusicMessage()); | ||||||
|     map.put(WxMpXmlOutNewsMessage.class, config_WxMpXmlOutNewsMessage()); |     map.put(WxMpXmlOutNewsMessage.class, config_WxMpXmlOutNewsMessage()); | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 BinaryWang
					BinaryWang