View Javadoc

1   /*
2    =================== DO NOT EDIT THIS FILE ====================
3    Generated by Modello 1.9.0-SNAPSHOT,
4    any modifications will be overwritten.
5    ==============================================================
6    */
7   
8   package org.codehaus.modello.test.features;
9   
10    //---------------------------------/
11   //- Imported classes and packages -/
12  //---------------------------------/
13  
14  import org.codehaus.modello.test.features.other.PackageNameFeature;
15  import org.codehaus.modello.test.features.other.SubInterfaceInPackage;
16  
17  /**
18   * 
19   *         Test of a bidirectional association, ie an association
20   * that has a reference to its parent.
21   *       
22   * 
23   * @version $Revision$ $Date$
24   */
25  @SuppressWarnings( "all" )
26  public class Bidirectional
27      implements java.io.Serializable
28  {
29  
30        //--------------------------/
31       //- Class/Member Variables -/
32      //--------------------------/
33  
34      /**
35       * Field parent.
36       */
37      private AssociationFeatures parent;
38  
39  
40        //-----------/
41       //- Methods -/
42      //-----------/
43  
44      /**
45       * Method breakAssociationFeaturesAssociation.
46       * 
47       * @param associationFeatures
48       */
49      public void breakAssociationFeaturesAssociation( AssociationFeatures associationFeatures )
50      {
51          if ( this.parent != associationFeatures )
52          {
53              throw new IllegalStateException( "associationFeatures isn't associated." );
54          }
55  
56          this.parent = null;
57      } //-- void breakAssociationFeaturesAssociation( AssociationFeatures )
58  
59      /**
60       * Method createAssociationFeaturesAssociation.
61       * 
62       * @param associationFeatures
63       */
64      public void createAssociationFeaturesAssociation( AssociationFeatures associationFeatures )
65      {
66          if ( this.parent != null )
67          {
68              breakAssociationFeaturesAssociation( this.parent );
69          }
70  
71          this.parent = associationFeatures;
72      } //-- void createAssociationFeaturesAssociation( AssociationFeatures )
73  
74      /**
75       * Get the parent field.
76       * 
77       * @return AssociationFeatures
78       */
79      public AssociationFeatures getParent()
80      {
81          return this.parent;
82      } //-- AssociationFeatures getParent()
83  
84      /**
85       * Set the parent field.
86       * 
87       * @param parent
88       */
89      public void setParent( AssociationFeatures parent )
90      {
91          if ( this.parent != null )
92          {
93              this.parent.breakBidirectionalAssociation( this );
94          }
95  
96          this.parent = parent;
97  
98          if ( parent != null )
99          {
100             this.parent.createBidirectionalAssociation( this );
101         }
102     } //-- void setParent( AssociationFeatures )
103 
104 }