001    package com.hammurapi.eventbus.tests;
002    
003    import com.hammurapi.common.Condition;
004    import com.hammurapi.eventbus.EventHandlerBase.Mode;
005    import com.hammurapi.eventbus.Handler;
006    import com.hammurapi.eventbus.local.LocalEventDispatchContext;
007    
008    public class RemoveHandler {
009            
010            private int worldCounter;
011            private boolean worldOk;
012            
013            private int emCounter;
014            private boolean emOk;
015            
016            public int getWorldCounter() {
017                    return worldCounter;
018            }
019    
020            public boolean isWorldOk() {
021                    return worldOk;
022            }
023    
024            public int getEmCounter() {
025                    return emCounter;
026            }
027    
028            public boolean isEmOk() {
029                    return emOk;
030            }
031    
032            @Handler(value="java(str)://str.equals(\"World\")", mode=Mode.REMOVE)
033            public void handleWorld(String str) {
034                    ++worldCounter;
035                    worldOk = "World".equals(str);
036            }
037            
038            @Handler(mode=Mode.REMOVE) //("\"!\".equals(args[0])")
039            public void handleEm(LocalEventDispatchContext<Object, Integer, Object> context, @Condition("\"!\".equals(str)") String str) {
040                    ++emCounter;
041                    emOk = "!".equals(str);
042                    context.post("Bye!");
043            }
044            
045            
046    }