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