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.GrandRules to event bus com.hammurapi.eventbus.tests.familyties.FamilyTiesEventBus |
17 | */ |
18 | public class GrandRulesJavaBinder 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.GrandRules> { |
19 | |
20 | @Override |
21 | public Set<java.lang.Long> bind(com.hammurapi.eventbus.tests.familyties.rules.GrandRules 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 | ret.add(infer0(instance, bus)); |
26 | ret.add(infer1(instance, bus)); |
27 | ret.add(infer2(instance, bus)); |
28 | |
29 | return ret; |
30 | } |
31 | |
32 | |
33 | private java.lang.Long infer(final com.hammurapi.eventbus.tests.familyties.rules.GrandRules instance, com.hammurapi.eventbus.tests.familyties.FamilyTiesEventBus bus) { |
34 | |
35 | Predicate<com.hammurapi.eventbus.tests.familyties.model.Relative, com.hammurapi.eventbus.tests.familyties.rules.FamilyTiesRules>[] predicates = new Predicate[1]; |
36 | |
37 | |
38 | predicates[0] = new com.hammurapi.extract.And(0, null, new com.hammurapi.extract.CommutativeAnd(0, null, new com.hammurapi.extract.InstanceOfPredicate(new com.hammurapi.extract.IndexedExtractor(1), com.hammurapi.eventbus.tests.familyties.model.Parent.class), new com.hammurapi.extract.InstanceOfPredicate(new com.hammurapi.extract.IndexedExtractor(0), com.hammurapi.eventbus.tests.familyties.model.Son.class)), new com.hammurapi.extract.Equal(0, null, new Extractor58(null), new Extractor59(null), false)); |
39 | |
40 | 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>( |
41 | 2, |
42 | 0, |
43 | instance, |
44 | true, |
45 | false, |
46 | Mode.POST, |
47 | predicates) { |
48 | |
49 | @Override |
50 | 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) { |
51 | com.hammurapi.eventbus.tests.familyties.model.GrandSon toPost = instance.infer( |
52 | |
53 | (com.hammurapi.eventbus.tests.familyties.model.Son) events[0], |
54 | (com.hammurapi.eventbus.tests.familyties.model.Parent) events[1] |
55 | ); |
56 | |
57 | |
58 | |
59 | if (com.hammurapi.eventbus.tests.familyties.model.Relative.class.isInstance(toPost)) { |
60 | context.post(toPost); |
61 | } |
62 | |
63 | } |
64 | |
65 | public String toString() { |
66 | return "Compiled event handler for method public com.hammurapi.eventbus.tests.familyties.model.GrandSon com.hammurapi.eventbus.tests.familyties.rules.GrandRules.infer(com.hammurapi.eventbus.tests.familyties.model.Son,com.hammurapi.eventbus.tests.familyties.model.Parent), cardinality="+getCardinality(); |
67 | } |
68 | |
69 | |
70 | }; |
71 | |
72 | return bus.addHandler(eventHandler); |
73 | } |
74 | |
75 | |
76 | private java.lang.Long infer0(final com.hammurapi.eventbus.tests.familyties.rules.GrandRules instance, com.hammurapi.eventbus.tests.familyties.FamilyTiesEventBus bus) { |
77 | |
78 | Predicate<com.hammurapi.eventbus.tests.familyties.model.Relative, com.hammurapi.eventbus.tests.familyties.rules.FamilyTiesRules>[] predicates = new Predicate[1]; |
79 | |
80 | |
81 | predicates[0] = new com.hammurapi.extract.And(0, null, new com.hammurapi.extract.CommutativeAnd(0, null, new com.hammurapi.extract.InstanceOfPredicate(new com.hammurapi.extract.IndexedExtractor(0), com.hammurapi.eventbus.tests.familyties.model.Daughter.class), new com.hammurapi.extract.InstanceOfPredicate(new com.hammurapi.extract.IndexedExtractor(1), com.hammurapi.eventbus.tests.familyties.model.Parent.class)), new com.hammurapi.extract.Equal(0, null, new Extractor60(null), new Extractor59(null), false)); |
82 | |
83 | 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>( |
84 | 2, |
85 | 0, |
86 | instance, |
87 | true, |
88 | false, |
89 | Mode.POST, |
90 | predicates) { |
91 | |
92 | @Override |
93 | 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) { |
94 | com.hammurapi.eventbus.tests.familyties.model.GrandDaughter toPost = instance.infer( |
95 | |
96 | (com.hammurapi.eventbus.tests.familyties.model.Daughter) events[0], |
97 | (com.hammurapi.eventbus.tests.familyties.model.Parent) events[1] |
98 | ); |
99 | |
100 | |
101 | |
102 | if (com.hammurapi.eventbus.tests.familyties.model.Relative.class.isInstance(toPost)) { |
103 | context.post(toPost); |
104 | } |
105 | |
106 | } |
107 | |
108 | public String toString() { |
109 | return "Compiled event handler for method public com.hammurapi.eventbus.tests.familyties.model.GrandDaughter com.hammurapi.eventbus.tests.familyties.rules.GrandRules.infer(com.hammurapi.eventbus.tests.familyties.model.Daughter,com.hammurapi.eventbus.tests.familyties.model.Parent), cardinality="+getCardinality(); |
110 | } |
111 | |
112 | |
113 | }; |
114 | |
115 | return bus.addHandler(eventHandler); |
116 | } |
117 | |
118 | |
119 | private java.lang.Long infer1(final com.hammurapi.eventbus.tests.familyties.rules.GrandRules instance, com.hammurapi.eventbus.tests.familyties.FamilyTiesEventBus bus) { |
120 | |
121 | Predicate<com.hammurapi.eventbus.tests.familyties.model.Relative, com.hammurapi.eventbus.tests.familyties.rules.FamilyTiesRules>[] predicates = new Predicate[1]; |
122 | |
123 | |
124 | predicates[0] = new com.hammurapi.extract.And(0, null, new com.hammurapi.extract.CommutativeAnd(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.InstanceOfPredicate(new com.hammurapi.extract.IndexedExtractor(1), com.hammurapi.eventbus.tests.familyties.model.Father.class)), new com.hammurapi.extract.Equal(0, null, new Extractor61(null), new Extractor62(null), false)); |
125 | |
126 | 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>( |
127 | 2, |
128 | 0, |
129 | instance, |
130 | true, |
131 | false, |
132 | Mode.POST, |
133 | predicates) { |
134 | |
135 | @Override |
136 | 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) { |
137 | com.hammurapi.eventbus.tests.familyties.model.GrandFather toPost = instance.infer( |
138 | |
139 | (com.hammurapi.eventbus.tests.familyties.model.Child) events[0], |
140 | (com.hammurapi.eventbus.tests.familyties.model.Father) events[1] |
141 | ); |
142 | |
143 | |
144 | |
145 | if (com.hammurapi.eventbus.tests.familyties.model.Relative.class.isInstance(toPost)) { |
146 | context.post(toPost); |
147 | } |
148 | |
149 | } |
150 | |
151 | public String toString() { |
152 | return "Compiled event handler for method public com.hammurapi.eventbus.tests.familyties.model.GrandFather com.hammurapi.eventbus.tests.familyties.rules.GrandRules.infer(com.hammurapi.eventbus.tests.familyties.model.Child,com.hammurapi.eventbus.tests.familyties.model.Father), cardinality="+getCardinality(); |
153 | } |
154 | |
155 | |
156 | }; |
157 | |
158 | return bus.addHandler(eventHandler); |
159 | } |
160 | |
161 | |
162 | private java.lang.Long infer2(final com.hammurapi.eventbus.tests.familyties.rules.GrandRules instance, com.hammurapi.eventbus.tests.familyties.FamilyTiesEventBus bus) { |
163 | |
164 | Predicate<com.hammurapi.eventbus.tests.familyties.model.Relative, com.hammurapi.eventbus.tests.familyties.rules.FamilyTiesRules>[] predicates = new Predicate[1]; |
165 | |
166 | |
167 | predicates[0] = new com.hammurapi.extract.And(0, null, new com.hammurapi.extract.CommutativeAnd(0, null, new com.hammurapi.extract.InstanceOfPredicate(new com.hammurapi.extract.IndexedExtractor(1), com.hammurapi.eventbus.tests.familyties.model.Mother.class), new com.hammurapi.extract.InstanceOfPredicate(new com.hammurapi.extract.IndexedExtractor(0), com.hammurapi.eventbus.tests.familyties.model.Child.class)), new com.hammurapi.extract.Equal(0, null, new Extractor61(null), new Extractor63(null), false)); |
168 | |
169 | 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>( |
170 | 2, |
171 | 0, |
172 | instance, |
173 | true, |
174 | false, |
175 | Mode.POST, |
176 | predicates) { |
177 | |
178 | @Override |
179 | 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) { |
180 | com.hammurapi.eventbus.tests.familyties.model.GrandMother toPost = instance.infer( |
181 | |
182 | (com.hammurapi.eventbus.tests.familyties.model.Child) events[0], |
183 | (com.hammurapi.eventbus.tests.familyties.model.Mother) events[1] |
184 | ); |
185 | |
186 | |
187 | |
188 | if (com.hammurapi.eventbus.tests.familyties.model.Relative.class.isInstance(toPost)) { |
189 | context.post(toPost); |
190 | } |
191 | |
192 | } |
193 | |
194 | public String toString() { |
195 | return "Compiled event handler for method public com.hammurapi.eventbus.tests.familyties.model.GrandMother com.hammurapi.eventbus.tests.familyties.rules.GrandRules.infer(com.hammurapi.eventbus.tests.familyties.model.Child,com.hammurapi.eventbus.tests.familyties.model.Mother), cardinality="+getCardinality(); |
196 | } |
197 | |
198 | |
199 | }; |
200 | |
201 | return bus.addHandler(eventHandler); |
202 | } |
203 | |
204 | |
205 | } |