| 1 | /* |
| 2 | @license.text@ |
| 3 | */ |
| 4 | package com.hammurapi.eventbus.tests.familyties.rules; |
| 5 | |
| 6 | import com.hammurapi.eventbus.Handler; |
| 7 | import com.hammurapi.eventbus.tests.familyties.model.Child; |
| 8 | import com.hammurapi.eventbus.tests.familyties.model.Parent; |
| 9 | |
| 10 | public class ParentChildRules extends FamilyTiesRules { |
| 11 | |
| 12 | /** |
| 13 | * Infers child relaitonship from parent relationship. |
| 14 | * @param parent |
| 15 | * @return |
| 16 | */ |
| 17 | @Handler |
| 18 | public Child infer(Parent parent) { |
| 19 | return new Child(parent.getObject(), parent.getSubject()); |
| 20 | } |
| 21 | |
| 22 | /** |
| 23 | * Infers parent relationship from child relationship |
| 24 | * @param child |
| 25 | * @return |
| 26 | */ |
| 27 | @Handler |
| 28 | public Parent infer(Child child) { |
| 29 | return new Parent(child.getObject(), child.getSubject()); |
| 30 | } |
| 31 | |
| 32 | } |