001 package com.hammurapi.eventbus.tests;
002
003 import com.hammurapi.common.Condition;
004 import com.hammurapi.eventbus.Handler;
005 import com.hammurapi.eventbus.local.LocalEventDispatchContext;
006
007 public class ParameterNamesJoinHandler {
008
009 private int helloCounter;
010 private boolean helloOk;
011
012 public int getHelloCounter() {
013 return helloCounter;
014 }
015
016 public boolean isHelloOk() {
017 return helloOk;
018 }
019
020 private int joinCounter;
021 private boolean joinOk;
022
023 public boolean isJoinOk() {
024 return joinOk;
025 }
026
027 public int getJoinCounter() {
028 return joinCounter;
029 }
030
031 @Handler("java(*)://str.equals(\"Hello\")")
032 public String handleHello(String str) {
033 ++helloCounter;
034 helloOk = "Hello".equals(str);
035 return "World";
036 }
037
038 @Handler({
039 "java(*)://world.equals(\"World\")",
040 "java(*)://AND(i+((int) 'A')> (int) hello.charAt(0),i+((int) 'A')< (int) world.charAt(0))"
041 })
042 public void join(
043 LocalEventDispatchContext<Object, Integer, Object> context,
044 @Condition("\"Hello\".equals(hello)") String hello,
045 String world,
046 int i) {
047 ++joinCounter;
048 joinOk = "Hello".equals(hello) && "World".equals(world) && i>'H'-'A' && i<'W'-'A';
049 }
050 }