001    /*
002    @license.text@
003     */
004    package com.hammurapi.eventbus.tests.familyties.rules;
005    
006    import com.hammurapi.eventbus.Handler;
007    import com.hammurapi.eventbus.tests.familyties.model.Child;
008    import com.hammurapi.eventbus.tests.familyties.model.Parent;
009    
010    public class ParentChildRules extends FamilyTiesRules {
011            
012            /**
013             * Infers child relaitonship from parent relationship.
014             * @param parent
015             * @return
016             */
017            @Handler        
018            public Child infer(Parent parent) {
019                    return new Child(parent.getObject(), parent.getSubject()); 
020            }
021            
022            /**
023             * Infers parent relationship from child relationship
024             * @param child
025             * @return
026             */
027            @Handler        
028            public Parent infer(Child child) {
029                    return new Parent(child.getObject(), child.getSubject()); 
030            }
031            
032    }