Blame view

src/main/java/com/jfinal/wxaapp/WxaConfigKit.java 1.16 KB
e80df919   atao   init
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
  package com.jfinal.wxaapp;
  
  import com.jfinal.wxaapp.msg.IMsgParser;
  import com.jfinal.wxaapp.msg.JsonMsgParser;
  import com.jfinal.wxaapp.msg.XmlMsgParser;
  
  /**
   * 小程序配置工具
   * @author L.cm
   *
   */
  public class WxaConfigKit {
  	private static WxaConfig wxaConfig;
      /**
       * 小程序消息解析
       */
      private static IMsgParser msgParser = new XmlMsgParser();
      /**
       * 获取小程序消息解析器
       * @return {IMsgParser}
       */
      public static IMsgParser getMsgParser() {
          return msgParser;
      }
      /**
       * 设置小程序消息解析器
       */
      public static void useJsonMsgParser() {
          WxaConfigKit.msgParser = new JsonMsgParser();
      }
  
      // 开发模式将输出消息交互 xml、json 到控制台
      private static boolean devMode = false;
  
      public static void setDevMode(boolean devMode) {
          WxaConfigKit.devMode = devMode;
      }
  
      public static boolean isDevMode() {
          return devMode;
      }
  
      public static void setWxaConfig(WxaConfig wxaConfig) {
          WxaConfigKit.wxaConfig = wxaConfig;
      }
      
      public static WxaConfig getWxaConfig() {
          return WxaConfigKit.wxaConfig;
      }
  }