| 1 | package com.hammurapi.eventbus.tests; |
| 2 | |
| 3 | import com.hammurapi.common.Condition; |
| 4 | import com.hammurapi.eventbus.Handler; |
| 5 | import com.hammurapi.eventbus.EventHandlerBase.Mode; |
| 6 | import com.hammurapi.eventbus.local.LocalEventDispatchJoinContext; |
| 7 | |
| 8 | public class JoinRemoveHandler { |
| 9 | |
| 10 | private int joinCounter; |
| 11 | private boolean joinOk; |
| 12 | |
| 13 | public boolean isJoinOk() { |
| 14 | return joinOk; |
| 15 | } |
| 16 | |
| 17 | public int getJoinCounter() { |
| 18 | return joinCounter; |
| 19 | } |
| 20 | |
| 21 | @Handler(mode=Mode.REMOVE, value="java(*)://world.equals(\"World\")") |
| 22 | public void join( |
| 23 | LocalEventDispatchJoinContext<Object, Integer, Object> context, |
| 24 | @Condition("\"Hello\".equals(hello)") String hello, |
| 25 | String world) { |
| 26 | ++joinCounter; |
| 27 | joinOk = "Hello".equals(hello) && "World".equals(world) && Mode.REMOVE.equals(context.getMode()); |
| 28 | } |
| 29 | } |