1
2
3
4
5
6 package org.codehaus.modello.test.features;
7
8
9
10
11
12 import org.codehaus.modello.test.features.other.PackageNameFeature;
13 import org.codehaus.modello.test.features.other.SubInterfaceInPackage;
14
15
16
17
18
19
20
21
22
23 @SuppressWarnings( "all" )
24 public class Bidirectional
25 implements java.io.Serializable
26 {
27
28
29
30
31
32
33
34
35 private AssociationFeatures parent;
36
37
38
39
40
41
42
43
44
45
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 }
56
57
58
59
60
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 }
71
72
73
74
75
76
77 public AssociationFeatures getParent()
78 {
79 return this.parent;
80 }
81
82
83
84
85
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 }
101
102 }