View Javadoc

1   //
2   // Attention: generated code (by MetafacadeLogic.vsl) - do not modify!
3   //
4   package org.andromda.metafacades.uml14;
5   
6   /***
7    * MetafacadeLogic for org.andromda.metafacades.uml.InstanceFacade
8    *
9    * @see org.andromda.metafacades.uml.InstanceFacade
10   */
11  public abstract class InstanceFacadeLogic
12      extends org.andromda.metafacades.uml14.ModelElementFacadeLogicImpl
13      implements org.andromda.metafacades.uml.InstanceFacade
14  {
15  
16      protected org.omg.uml.behavioralelements.commonbehavior.Instance metaObject;
17  
18      public InstanceFacadeLogic(org.omg.uml.behavioralelements.commonbehavior.Instance metaObject, String context)
19      {
20          super(metaObject, getContext(context));
21          this.metaObject = metaObject;
22      }
23  
24      /***
25       * Gets the context for this metafacade logic instance.
26       */
27      private static String getContext(String context)
28      {
29          if (context == null)
30          {
31              context = "org.andromda.metafacades.uml.InstanceFacade";
32          }
33          return context;
34      }
35  
36      /***
37       * @see org.andromda.core.metafacade.MetafacadeBase
38       */
39      public void resetMetafacadeContext(String context)
40      {
41          if (!this.contextRoot) // reset context only for non-root metafacades
42          {
43              context = getContext(context);  // to have same value as in original constructor call
44              setMetafacadeContext (context);
45          }
46      }
47  
48      /***
49       * @see org.andromda.metafacades.uml.InstanceFacade
50       */
51      public boolean isInstanceFacadeMetaType()
52      {
53          return true;
54      }
55      
56      // ------------- associations ------------------
57  
58      private void handleGetClassifiers1rPreCondition()
59      {
60      }
61  
62      private void handleGetClassifiers1rPostCondition()
63      {
64      }
65  
66      private java.util.Collection __getClassifiers1r;
67      private boolean __getClassifiers1rSet = false;
68  
69      public final java.util.Collection getClassifiers()
70      {
71          java.util.Collection getClassifiers1r = this.__getClassifiers1r;
72          if (!this.__getClassifiers1rSet)
73          {
74              handleGetClassifiers1rPreCondition();
75              Object result = this.shieldedElements(handleGetClassifiers());
76              try
77              {
78                  getClassifiers1r = (java.util.Collection)result;
79              }
80              catch (ClassCastException ex)
81              {
82                  // ignore since the metafacade shouldn't
83                  // be set if its not of the correct type
84              }
85              handleGetClassifiers1rPostCondition();
86              this.__getClassifiers1r = getClassifiers1r;
87              if (isMetafacadePropertyCachingEnabled())
88              {
89                  this.__getClassifiers1rSet = true;
90              }
91          }
92          return getClassifiers1r;
93      }
94  
95      protected abstract java.util.Collection handleGetClassifiers();
96  
97      private void handleGetLinkEnds2rPreCondition()
98      {
99      }
100 
101     private void handleGetLinkEnds2rPostCondition()
102     {
103     }
104 
105     private java.util.Collection __getLinkEnds2r;
106     private boolean __getLinkEnds2rSet = false;
107 
108     public final java.util.Collection getLinkEnds()
109     {
110         java.util.Collection getLinkEnds2r = this.__getLinkEnds2r;
111         if (!this.__getLinkEnds2rSet)
112         {
113             handleGetLinkEnds2rPreCondition();
114             Object result = this.shieldedElements(handleGetLinkEnds());
115             try
116             {
117                 getLinkEnds2r = (java.util.Collection)result;
118             }
119             catch (ClassCastException ex)
120             {
121                 // ignore since the metafacade shouldn't
122                 // be set if its not of the correct type
123             }
124             handleGetLinkEnds2rPostCondition();
125             this.__getLinkEnds2r = getLinkEnds2r;
126             if (isMetafacadePropertyCachingEnabled())
127             {
128                 this.__getLinkEnds2rSet = true;
129             }
130         }
131         return getLinkEnds2r;
132     }
133 
134     protected abstract java.util.Collection handleGetLinkEnds();
135 
136     private void handleGetOwnedInstances3rPreCondition()
137     {
138     }
139 
140     private void handleGetOwnedInstances3rPostCondition()
141     {
142     }
143 
144     private java.util.Collection __getOwnedInstances3r;
145     private boolean __getOwnedInstances3rSet = false;
146 
147     public final java.util.Collection getOwnedInstances()
148     {
149         java.util.Collection getOwnedInstances3r = this.__getOwnedInstances3r;
150         if (!this.__getOwnedInstances3rSet)
151         {
152             handleGetOwnedInstances3rPreCondition();
153             Object result = this.shieldedElements(handleGetOwnedInstances());
154             try
155             {
156                 getOwnedInstances3r = (java.util.Collection)result;
157             }
158             catch (ClassCastException ex)
159             {
160                 // ignore since the metafacade shouldn't
161                 // be set if its not of the correct type
162             }
163             handleGetOwnedInstances3rPostCondition();
164             this.__getOwnedInstances3r = getOwnedInstances3r;
165             if (isMetafacadePropertyCachingEnabled())
166             {
167                 this.__getOwnedInstances3rSet = true;
168             }
169         }
170         return getOwnedInstances3r;
171     }
172 
173     protected abstract java.util.Collection handleGetOwnedInstances();
174 
175     private void handleGetOwnedLinks5rPreCondition()
176     {
177     }
178 
179     private void handleGetOwnedLinks5rPostCondition()
180     {
181     }
182 
183     private java.util.Collection __getOwnedLinks5r;
184     private boolean __getOwnedLinks5rSet = false;
185 
186     public final java.util.Collection getOwnedLinks()
187     {
188         java.util.Collection getOwnedLinks5r = this.__getOwnedLinks5r;
189         if (!this.__getOwnedLinks5rSet)
190         {
191             handleGetOwnedLinks5rPreCondition();
192             Object result = this.shieldedElements(handleGetOwnedLinks());
193             try
194             {
195                 getOwnedLinks5r = (java.util.Collection)result;
196             }
197             catch (ClassCastException ex)
198             {
199                 // ignore since the metafacade shouldn't
200                 // be set if its not of the correct type
201             }
202             handleGetOwnedLinks5rPostCondition();
203             this.__getOwnedLinks5r = getOwnedLinks5r;
204             if (isMetafacadePropertyCachingEnabled())
205             {
206                 this.__getOwnedLinks5rSet = true;
207             }
208         }
209         return getOwnedLinks5r;
210     }
211 
212     protected abstract java.util.Collection handleGetOwnedLinks();
213 
214     private void handleGetAttributeLinks6rPreCondition()
215     {
216     }
217 
218     private void handleGetAttributeLinks6rPostCondition()
219     {
220     }
221 
222     private java.util.Collection __getAttributeLinks6r;
223     private boolean __getAttributeLinks6rSet = false;
224 
225     public final java.util.Collection getAttributeLinks()
226     {
227         java.util.Collection getAttributeLinks6r = this.__getAttributeLinks6r;
228         if (!this.__getAttributeLinks6rSet)
229         {
230             handleGetAttributeLinks6rPreCondition();
231             Object result = this.shieldedElements(handleGetAttributeLinks());
232             try
233             {
234                 getAttributeLinks6r = (java.util.Collection)result;
235             }
236             catch (ClassCastException ex)
237             {
238                 // ignore since the metafacade shouldn't
239                 // be set if its not of the correct type
240             }
241             handleGetAttributeLinks6rPostCondition();
242             this.__getAttributeLinks6r = getAttributeLinks6r;
243             if (isMetafacadePropertyCachingEnabled())
244             {
245                 this.__getAttributeLinks6rSet = true;
246             }
247         }
248         return getAttributeLinks6r;
249     }
250 
251     protected abstract java.util.Collection handleGetAttributeLinks();
252 
253     private void handleGetSlots8rPreCondition()
254     {
255     }
256 
257     private void handleGetSlots8rPostCondition()
258     {
259     }
260 
261     public final java.util.Collection getSlots()
262     {
263         java.util.Collection getSlots8r = null;
264         handleGetSlots8rPreCondition();
265         Object result = this.shieldedElements(handleGetSlots());
266         try
267         {
268             getSlots8r = (java.util.Collection)result;
269         }
270         catch (ClassCastException ex)
271         {
272             // ignore since the metafacade shouldn't
273             // be set if its not of the correct type
274         }
275         handleGetSlots8rPostCondition();
276         return getSlots8r;
277     }
278 
279     protected abstract java.util.Collection handleGetSlots();
280 
281     /***
282      * @see org.andromda.core.metafacade.MetafacadeBase#validateInvariants(java.util.Collection)
283      */
284     public void validateInvariants(java.util.Collection validationMessages)
285     {
286         super.validateInvariants(validationMessages);
287     }
288     
289     /***
290      * The property that stores the name of the metafacade.
291      */
292     private static final String NAME_PROPERTY = "name";
293     
294     /***
295      * @see java.lang.Object#toString()
296      */
297     public String toString()
298     {
299         final StringBuffer toString = new StringBuffer(this.getClass().getName());
300         toString.append("[");
301         try
302         {
303             toString.append(org.andromda.core.common.Introspector.instance().getProperty(this, NAME_PROPERTY));
304         }
305         catch (final Throwable throwable)
306         {
307             // - just ignore when the metafacade doesn't have a name property
308         }
309         toString.append("]");
310         return toString.toString();
311     }
312 }