| 1 | package com.hammurapi.eventbus.tests.familyties.rules; |
| 2 | |
| 3 | import java.util.HashSet; |
| 4 | import java.util.Set; |
| 5 | |
| 6 | import com.hammurapi.eventbus.AbstractEventBus; |
| 7 | import com.hammurapi.eventbus.AbstractEventBus.Handle; |
| 8 | import com.hammurapi.eventbus.AbstractEventHandler; |
| 9 | import com.hammurapi.eventbus.EventDispatchContext; |
| 10 | import com.hammurapi.eventbus.EventHandler; |
| 11 | import com.hammurapi.eventbus.JavaBinder; |
| 12 | import com.hammurapi.extract.Predicate; |
| 13 | import com.hammurapi.eventbus.EventHandlerBase.Mode; |
| 14 | |
| 15 | /** |
| 16 | * Binds handler class com.hammurapi.eventbus.tests.familyties.rules.SonRule to event bus com.hammurapi.eventbus.tests.familyties.FamilyTiesEventBus |
| 17 | */ |
| 18 | public class SonRuleJavaBinder implements JavaBinder<com.hammurapi.eventbus.tests.familyties.model.Relative, com.hammurapi.eventbus.tests.familyties.rules.FamilyTiesRules, java.lang.Long, com.hammurapi.eventbus.AbstractEventBus.Handle<com.hammurapi.eventbus.tests.familyties.model.Relative, java.lang.Integer, com.hammurapi.eventbus.tests.familyties.rules.FamilyTiesRules, java.lang.Long>, com.hammurapi.eventbus.tests.familyties.FamilyTiesEventStore, com.hammurapi.eventbus.tests.familyties.FamilyTiesEventBus, com.hammurapi.eventbus.tests.familyties.rules.SonRule> { |
| 19 | |
| 20 | @Override |
| 21 | public Set<java.lang.Long> bind(com.hammurapi.eventbus.tests.familyties.rules.SonRule instance, com.hammurapi.eventbus.tests.familyties.FamilyTiesEventBus bus) { |
| 22 | Set<java.lang.Long> ret = new HashSet<java.lang.Long>(); |
| 23 | |
| 24 | ret.add(infer(instance, bus)); |
| 25 | |
| 26 | return ret; |
| 27 | } |
| 28 | |
| 29 | |
| 30 | private java.lang.Long infer(final com.hammurapi.eventbus.tests.familyties.rules.SonRule instance, com.hammurapi.eventbus.tests.familyties.FamilyTiesEventBus bus) { |
| 31 | |
| 32 | Predicate<com.hammurapi.eventbus.tests.familyties.model.Relative, com.hammurapi.eventbus.tests.familyties.rules.FamilyTiesRules>[] predicates = new Predicate[1]; |
| 33 | |
| 34 | |
| 35 | predicates[0] = new com.hammurapi.extract.And(0, null, new com.hammurapi.extract.InstanceOfPredicate(new com.hammurapi.extract.IndexedExtractor(0), com.hammurapi.eventbus.tests.familyties.model.Child.class), new com.hammurapi.extract.Not(new com.hammurapi.extract.InstanceOfPredicate(new Extractor57(null), com.hammurapi.eventbus.tests.familyties.model.Son.class)), new Predicate9(null)); |
| 36 | |
| 37 | EventHandler<com.hammurapi.eventbus.tests.familyties.model.Relative, java.lang.Integer, com.hammurapi.eventbus.tests.familyties.rules.FamilyTiesRules, com.hammurapi.eventbus.AbstractEventBus.Handle<com.hammurapi.eventbus.tests.familyties.model.Relative, java.lang.Integer, com.hammurapi.eventbus.tests.familyties.rules.FamilyTiesRules, java.lang.Long>, com.hammurapi.eventbus.tests.familyties.FamilyTiesEventStore> eventHandler = new AbstractEventHandler<com.hammurapi.eventbus.tests.familyties.model.Relative, java.lang.Integer, com.hammurapi.eventbus.tests.familyties.rules.FamilyTiesRules, com.hammurapi.eventbus.AbstractEventBus.Handle<com.hammurapi.eventbus.tests.familyties.model.Relative, java.lang.Integer, com.hammurapi.eventbus.tests.familyties.rules.FamilyTiesRules, java.lang.Long>, com.hammurapi.eventbus.tests.familyties.FamilyTiesEventStore>( |
| 38 | 1, |
| 39 | 0, |
| 40 | instance, |
| 41 | true, |
| 42 | false, |
| 43 | Mode.POST, |
| 44 | predicates) { |
| 45 | |
| 46 | @Override |
| 47 | public void post(EventDispatchContext<com.hammurapi.eventbus.tests.familyties.model.Relative, java.lang.Integer, com.hammurapi.eventbus.tests.familyties.rules.FamilyTiesRules, com.hammurapi.eventbus.AbstractEventBus.Handle<com.hammurapi.eventbus.tests.familyties.model.Relative, java.lang.Integer, com.hammurapi.eventbus.tests.familyties.rules.FamilyTiesRules, java.lang.Long>, com.hammurapi.eventbus.tests.familyties.FamilyTiesEventStore> context, com.hammurapi.eventbus.tests.familyties.model.Relative... events) { |
| 48 | com.hammurapi.eventbus.tests.familyties.model.Son toPost = instance.infer( |
| 49 | |
| 50 | (com.hammurapi.eventbus.tests.familyties.model.Child) events[0] |
| 51 | ); |
| 52 | |
| 53 | |
| 54 | |
| 55 | if (com.hammurapi.eventbus.tests.familyties.model.Relative.class.isInstance(toPost)) { |
| 56 | context.post(toPost); |
| 57 | } |
| 58 | |
| 59 | } |
| 60 | |
| 61 | public String toString() { |
| 62 | return "Compiled event handler for method public com.hammurapi.eventbus.tests.familyties.model.Son com.hammurapi.eventbus.tests.familyties.rules.SonRule.infer(com.hammurapi.eventbus.tests.familyties.model.Child), cardinality="+getCardinality(); |
| 63 | } |
| 64 | |
| 65 | |
| 66 | }; |
| 67 | |
| 68 | return bus.addHandler(eventHandler); |
| 69 | } |
| 70 | |
| 71 | |
| 72 | } |