me.chanjar.weixin.mp.api

## 类 WxMpMessageRouterRule

- java.lang.Object
- - me.chanjar.weixin.mp.api.WxMpMessageRouterRule

    public class WxMpMessageRouterRule
    extends Object

### 构造器概要

构造器
构造器和说明
`WxMpMessageRouterRule(WxMpMessageRouter routerBuilder)`

### 方法概要

方法
`WxMpMessageRouterRule` `async(boolean async)` 设置是否异步执行，默认是true
`WxMpMessageRouterRule` `content(String content)` 如果content等于某值
`WxMpMessageRouter` `end()` 规则结束，代表如果一个消息匹配该规则，那么它将不再会进入其他规则
`WxMpMessageRouterRule` `event(String event)` 如果event等于某值
`WxMpMessageRouterRule` `eventKey(String eventKey)` 如果eventKey等于某值
`WxMpMessageRouterRule` `fromUser(String fromUser)` 如果fromUser等于某值
`String` `getContent()`
`String` `getEvent()`
`String` `getEventKey()`
`String` `getFromUser()`
`List<WxMpMessageHandler>` `getHandlers()`
`List<WxMpMessageInterceptor>` `getInterceptors()`
`WxMpMessageMatcher` `getMatcher()`
`String` `getMsgType()`
`String` `getrContent()`
`WxMpMessageRouter` `getRouterBuilder()`
`WxMpMessageRouterRule` `handler(WxMpMessageHandler handler)` 设置微信消息处理器
`WxMpMessageRouterRule` `handler(WxMpMessageHandler handler, WxMpMessageHandler... otherHandlers)` 设置微信消息处理器
`WxMpMessageRouterRule` `interceptor(WxMpMessageInterceptor interceptor)` 设置微信消息拦截器
`WxMpMessageRouterRule` `interceptor(WxMpMessageInterceptor interceptor, WxMpMessageInterceptor... otherInterceptors)` 设置微信消息拦截器
`boolean` `isAsync()`
`boolean` `isReEnter()`
`WxMpMessageRouterRule` `matcher(WxMpMessageMatcher matcher)` 如果消息匹配某个matcher，用在用户需要自定义更复杂的匹配规则的时候
`WxMpMessageRouterRule` `msgType(String msgType)` 如果msgType等于某值
`WxMpMessageRouter` `next()` 规则结束，但是消息还会进入其他规则
`WxMpMessageRouterRule` `rContent(String regex)` 如果content匹配该正则表达式
`protected WxMpXmlOutMessage` `service(WxMpXmlMessage wxMessage, WxMpService wxMpService, WxSessionManager sessionManager, WxErrorExceptionHandler exceptionHandler)` 处理微信推送过来的消息
`void` `setAsync(boolean async)`
`void` `setContent(String content)`
`void` `setEvent(String event)`
`void` `setEventKey(String eventKey)`
`void` `setFromUser(String fromUser)`
`void` `setHandlers(List<WxMpMessageHandler> handlers)`
`void` `setInterceptors(List<WxMpMessageInterceptor> interceptors)`
`void` `setMatcher(WxMpMessageMatcher matcher)`
`void` `setMsgType(String msgType)`
`void` `setrContent(String rContent)`
`void` `setReEnter(boolean reEnter)`
`protected boolean` `test(WxMpXmlMessage wxMessage)` 将微信自定义的事件修正为不区分大小写, 比如框架定义的事件常量为click，但微信传递过来的却是CLICK

### 从类继承的方法 java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### 构造器详细资料

#### WxMpMessageRouterRule

    public WxMpMessageRouterRule(WxMpMessageRouter routerBuilder)

### 方法详细资料

#### async

    public WxMpMessageRouterRule async(boolean async)

设置是否异步执行，默认是true

#### msgType

    public WxMpMessageRouterRule msgType(String msgType)

如果msgType等于某值

#### event

    public WxMpMessageRouterRule event(String event)

如果event等于某值

#### eventKey

    public WxMpMessageRouterRule eventKey(String eventKey)

如果eventKey等于某值

#### content

    public WxMpMessageRouterRule content(String content)

如果content等于某值

#### rContent

    public WxMpMessageRouterRule rContent(String regex)

如果content匹配该正则表达式

#### fromUser

    public WxMpMessageRouterRule fromUser(String fromUser)

如果fromUser等于某值

#### matcher

    public WxMpMessageRouterRule matcher(WxMpMessageMatcher matcher)

如果消息匹配某个matcher，用在用户需要自定义更复杂的匹配规则的时候

#### interceptor

    public WxMpMessageRouterRule interceptor(WxMpMessageInterceptor interceptor)

设置微信消息拦截器

#### interceptor

    public WxMpMessageRouterRule interceptor(WxMpMessageInterceptor interceptor,
                                    WxMpMessageInterceptor... otherInterceptors)

设置微信消息拦截器

#### handler

    public WxMpMessageRouterRule handler(WxMpMessageHandler handler)

设置微信消息处理器

#### handler

    public WxMpMessageRouterRule handler(WxMpMessageHandler handler,
                                WxMpMessageHandler... otherHandlers)

设置微信消息处理器

#### end

    public WxMpMessageRouter end()

规则结束，代表如果一个消息匹配该规则，那么它将不再会进入其他规则

#### next

    public WxMpMessageRouter next()

规则结束，但是消息还会进入其他规则

#### test

    protected boolean test(WxMpXmlMessage wxMessage)

将微信自定义的事件修正为不区分大小写, 比如框架定义的事件常量为click，但微信传递过来的却是CLICK

#### service

    protected WxMpXmlOutMessage service(WxMpXmlMessage wxMessage,
                            WxMpService wxMpService,
                            WxSessionManager sessionManager,
                            WxErrorExceptionHandler exceptionHandler)

处理微信推送过来的消息

参数:
  `wxMessage` -
返回:
  true 代表继续执行别的router，false 代表停止执行别的router

#### getRouterBuilder

    public WxMpMessageRouter getRouterBuilder()

#### isAsync

    public boolean isAsync()

#### setAsync

    public void setAsync(boolean async)

#### getFromUser

    public String getFromUser()

#### setFromUser

    public void setFromUser(String fromUser)

#### getMsgType

    public String getMsgType()

#### setMsgType

    public void setMsgType(String msgType)

#### getEvent

    public String getEvent()

#### setEvent

    public void setEvent(String event)

#### getEventKey

    public String getEventKey()

#### setEventKey

    public void setEventKey(String eventKey)

#### getContent

    public String getContent()

#### setContent

    public void setContent(String content)

#### getrContent

    public String getrContent()

#### setrContent

    public void setrContent(String rContent)

#### getMatcher

    public WxMpMessageMatcher getMatcher()

#### setMatcher

    public void setMatcher(WxMpMessageMatcher matcher)

#### isReEnter

    public boolean isReEnter()

#### setReEnter

    public void setReEnter(boolean reEnter)

#### getHandlers

    public List<WxMpMessageHandler> getHandlers()

#### setHandlers

    public void setHandlers(List<WxMpMessageHandler> handlers)

#### getInterceptors

    public List<WxMpMessageInterceptor> getInterceptors()

#### setInterceptors

    public void setInterceptors(List<WxMpMessageInterceptor> interceptors)