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.ParameterFacade
8    *
9    * @see org.andromda.metafacades.uml.ParameterFacade
10   */
11  public abstract class ParameterFacadeLogic
12      extends org.andromda.metafacades.uml14.ModelElementFacadeLogicImpl
13      implements org.andromda.metafacades.uml.ParameterFacade
14  {
15  
16      protected org.omg.uml.foundation.core.Parameter metaObject;
17  
18      public ParameterFacadeLogic(org.omg.uml.foundation.core.Parameter 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.ParameterFacade";
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.ParameterFacade
50       */
51      public boolean isParameterFacadeMetaType()
52      {
53          return true;
54      }
55      
56      // --------------- attributes ---------------------
57  
58     /***
59      * @see org.andromda.metafacades.uml.ParameterFacade#getDefaultValue()
60      */
61      protected abstract java.lang.String handleGetDefaultValue();
62  
63      private void handleGetDefaultValue1aPreCondition()
64      {
65      }
66  
67      private void handleGetDefaultValue1aPostCondition()
68      {
69      }
70  
71      private java.lang.String __defaultValue1a;
72      private boolean __defaultValue1aSet = false;
73  
74      public final java.lang.String getDefaultValue()
75      {
76          java.lang.String defaultValue1a = this.__defaultValue1a;
77          if (!this.__defaultValue1aSet)
78          {
79              handleGetDefaultValue1aPreCondition();
80              defaultValue1a = handleGetDefaultValue();
81              handleGetDefaultValue1aPostCondition();
82              this.__defaultValue1a = defaultValue1a;
83              if (isMetafacadePropertyCachingEnabled())
84              {
85                  this.__defaultValue1aSet = true;
86              }
87          }
88          return defaultValue1a;
89      }
90  
91     /***
92      * @see org.andromda.metafacades.uml.ParameterFacade#isReturn()
93      */
94      protected abstract boolean handleIsReturn();
95  
96      private void handleIsReturn2aPreCondition()
97      {
98      }
99  
100     private void handleIsReturn2aPostCondition()
101     {
102     }
103 
104     private boolean __return2a;
105     private boolean __return2aSet = false;
106 
107     public final boolean isReturn()
108     {
109         boolean return2a = this.__return2a;
110         if (!this.__return2aSet)
111         {
112             handleIsReturn2aPreCondition();
113             return2a = handleIsReturn();
114             handleIsReturn2aPostCondition();
115             this.__return2a = return2a;
116             if (isMetafacadePropertyCachingEnabled())
117             {
118                 this.__return2aSet = true;
119             }
120         }
121         return return2a;
122     }
123 
124    /***
125     * @see org.andromda.metafacades.uml.ParameterFacade#isRequired()
126     */
127     protected abstract boolean handleIsRequired();
128 
129     private void handleIsRequired3aPreCondition()
130     {
131     }
132 
133     private void handleIsRequired3aPostCondition()
134     {
135     }
136 
137     private boolean __required3a;
138     private boolean __required3aSet = false;
139 
140     public final boolean isRequired()
141     {
142         boolean required3a = this.__required3a;
143         if (!this.__required3aSet)
144         {
145             handleIsRequired3aPreCondition();
146             required3a = handleIsRequired();
147             handleIsRequired3aPostCondition();
148             this.__required3a = required3a;
149             if (isMetafacadePropertyCachingEnabled())
150             {
151                 this.__required3aSet = true;
152             }
153         }
154         return required3a;
155     }
156 
157    /***
158     * @see org.andromda.metafacades.uml.ParameterFacade#getGetterName()
159     */
160     protected abstract java.lang.String handleGetGetterName();
161 
162     private void handleGetGetterName4aPreCondition()
163     {
164     }
165 
166     private void handleGetGetterName4aPostCondition()
167     {
168     }
169 
170     private java.lang.String __getterName4a;
171     private boolean __getterName4aSet = false;
172 
173     public final java.lang.String getGetterName()
174     {
175         java.lang.String getterName4a = this.__getterName4a;
176         if (!this.__getterName4aSet)
177         {
178             handleGetGetterName4aPreCondition();
179             getterName4a = handleGetGetterName();
180             handleGetGetterName4aPostCondition();
181             this.__getterName4a = getterName4a;
182             if (isMetafacadePropertyCachingEnabled())
183             {
184                 this.__getterName4aSet = true;
185             }
186         }
187         return getterName4a;
188     }
189 
190    /***
191     * @see org.andromda.metafacades.uml.ParameterFacade#getSetterName()
192     */
193     protected abstract java.lang.String handleGetSetterName();
194 
195     private void handleGetSetterName5aPreCondition()
196     {
197     }
198 
199     private void handleGetSetterName5aPostCondition()
200     {
201     }
202 
203     private java.lang.String __setterName5a;
204     private boolean __setterName5aSet = false;
205 
206     public final java.lang.String getSetterName()
207     {
208         java.lang.String setterName5a = this.__setterName5a;
209         if (!this.__setterName5aSet)
210         {
211             handleGetSetterName5aPreCondition();
212             setterName5a = handleGetSetterName();
213             handleGetSetterName5aPostCondition();
214             this.__setterName5a = setterName5a;
215             if (isMetafacadePropertyCachingEnabled())
216             {
217                 this.__setterName5aSet = true;
218             }
219         }
220         return setterName5a;
221     }
222 
223    /***
224     * @see org.andromda.metafacades.uml.ParameterFacade#isReadable()
225     */
226     protected abstract boolean handleIsReadable();
227 
228     private void handleIsReadable6aPreCondition()
229     {
230     }
231 
232     private void handleIsReadable6aPostCondition()
233     {
234     }
235 
236     private boolean __readable6a;
237     private boolean __readable6aSet = false;
238 
239     public final boolean isReadable()
240     {
241         boolean readable6a = this.__readable6a;
242         if (!this.__readable6aSet)
243         {
244             handleIsReadable6aPreCondition();
245             readable6a = handleIsReadable();
246             handleIsReadable6aPostCondition();
247             this.__readable6a = readable6a;
248             if (isMetafacadePropertyCachingEnabled())
249             {
250                 this.__readable6aSet = true;
251             }
252         }
253         return readable6a;
254     }
255 
256    /***
257     * @see org.andromda.metafacades.uml.ParameterFacade#isWritable()
258     */
259     protected abstract boolean handleIsWritable();
260 
261     private void handleIsWritable7aPreCondition()
262     {
263     }
264 
265     private void handleIsWritable7aPostCondition()
266     {
267     }
268 
269     private boolean __writable7a;
270     private boolean __writable7aSet = false;
271 
272     public final boolean isWritable()
273     {
274         boolean writable7a = this.__writable7a;
275         if (!this.__writable7aSet)
276         {
277             handleIsWritable7aPreCondition();
278             writable7a = handleIsWritable();
279             handleIsWritable7aPostCondition();
280             this.__writable7a = writable7a;
281             if (isMetafacadePropertyCachingEnabled())
282             {
283                 this.__writable7aSet = true;
284             }
285         }
286         return writable7a;
287     }
288 
289    /***
290     * @see org.andromda.metafacades.uml.ParameterFacade#isDefaultValuePresent()
291     */
292     protected abstract boolean handleIsDefaultValuePresent();
293 
294     private void handleIsDefaultValuePresent8aPreCondition()
295     {
296     }
297 
298     private void handleIsDefaultValuePresent8aPostCondition()
299     {
300     }
301 
302     private boolean __defaultValuePresent8a;
303     private boolean __defaultValuePresent8aSet = false;
304 
305     public final boolean isDefaultValuePresent()
306     {
307         boolean defaultValuePresent8a = this.__defaultValuePresent8a;
308         if (!this.__defaultValuePresent8aSet)
309         {
310             handleIsDefaultValuePresent8aPreCondition();
311             defaultValuePresent8a = handleIsDefaultValuePresent();
312             handleIsDefaultValuePresent8aPostCondition();
313             this.__defaultValuePresent8a = defaultValuePresent8a;
314             if (isMetafacadePropertyCachingEnabled())
315             {
316                 this.__defaultValuePresent8aSet = true;
317             }
318         }
319         return defaultValuePresent8a;
320     }
321 
322    /***
323     * @see org.andromda.metafacades.uml.ParameterFacade#isInParameter()
324     */
325     protected abstract boolean handleIsInParameter();
326 
327     private void handleIsInParameter9aPreCondition()
328     {
329     }
330 
331     private void handleIsInParameter9aPostCondition()
332     {
333     }
334 
335     private boolean __inParameter9a;
336     private boolean __inParameter9aSet = false;
337 
338     public final boolean isInParameter()
339     {
340         boolean inParameter9a = this.__inParameter9a;
341         if (!this.__inParameter9aSet)
342         {
343             handleIsInParameter9aPreCondition();
344             inParameter9a = handleIsInParameter();
345             handleIsInParameter9aPostCondition();
346             this.__inParameter9a = inParameter9a;
347             if (isMetafacadePropertyCachingEnabled())
348             {
349                 this.__inParameter9aSet = true;
350             }
351         }
352         return inParameter9a;
353     }
354 
355    /***
356     * @see org.andromda.metafacades.uml.ParameterFacade#isOutParameter()
357     */
358     protected abstract boolean handleIsOutParameter();
359 
360     private void handleIsOutParameter10aPreCondition()
361     {
362     }
363 
364     private void handleIsOutParameter10aPostCondition()
365     {
366     }
367 
368     private boolean __outParameter10a;
369     private boolean __outParameter10aSet = false;
370 
371     public final boolean isOutParameter()
372     {
373         boolean outParameter10a = this.__outParameter10a;
374         if (!this.__outParameter10aSet)
375         {
376             handleIsOutParameter10aPreCondition();
377             outParameter10a = handleIsOutParameter();
378             handleIsOutParameter10aPostCondition();
379             this.__outParameter10a = outParameter10a;
380             if (isMetafacadePropertyCachingEnabled())
381             {
382                 this.__outParameter10aSet = true;
383             }
384         }
385         return outParameter10a;
386     }
387 
388    /***
389     * @see org.andromda.metafacades.uml.ParameterFacade#isInoutParameter()
390     */
391     protected abstract boolean handleIsInoutParameter();
392 
393     private void handleIsInoutParameter11aPreCondition()
394     {
395     }
396 
397     private void handleIsInoutParameter11aPostCondition()
398     {
399     }
400 
401     private boolean __inoutParameter11a;
402     private boolean __inoutParameter11aSet = false;
403 
404     public final boolean isInoutParameter()
405     {
406         boolean inoutParameter11a = this.__inoutParameter11a;
407         if (!this.__inoutParameter11aSet)
408         {
409             handleIsInoutParameter11aPreCondition();
410             inoutParameter11a = handleIsInoutParameter();
411             handleIsInoutParameter11aPostCondition();
412             this.__inoutParameter11a = inoutParameter11a;
413             if (isMetafacadePropertyCachingEnabled())
414             {
415                 this.__inoutParameter11aSet = true;
416             }
417         }
418         return inoutParameter11a;
419     }
420 
421    /***
422     * @see org.andromda.metafacades.uml.ParameterFacade#getUpper()
423     */
424     protected abstract int handleGetUpper();
425 
426     private void handleGetUpper12aPreCondition()
427     {
428     }
429 
430     private void handleGetUpper12aPostCondition()
431     {
432     }
433 
434     private int __upper12a;
435     private boolean __upper12aSet = false;
436 
437     public final int getUpper()
438     {
439         int upper12a = this.__upper12a;
440         if (!this.__upper12aSet)
441         {
442             handleGetUpper12aPreCondition();
443             upper12a = handleGetUpper();
444             handleGetUpper12aPostCondition();
445             this.__upper12a = upper12a;
446             if (isMetafacadePropertyCachingEnabled())
447             {
448                 this.__upper12aSet = true;
449             }
450         }
451         return upper12a;
452     }
453 
454    /***
455     * @see org.andromda.metafacades.uml.ParameterFacade#getLower()
456     */
457     protected abstract int handleGetLower();
458 
459     private void handleGetLower13aPreCondition()
460     {
461     }
462 
463     private void handleGetLower13aPostCondition()
464     {
465     }
466 
467     private int __lower13a;
468     private boolean __lower13aSet = false;
469 
470     public final int getLower()
471     {
472         int lower13a = this.__lower13a;
473         if (!this.__lower13aSet)
474         {
475             handleGetLower13aPreCondition();
476             lower13a = handleGetLower();
477             handleGetLower13aPostCondition();
478             this.__lower13a = lower13a;
479             if (isMetafacadePropertyCachingEnabled())
480             {
481                 this.__lower13aSet = true;
482             }
483         }
484         return lower13a;
485     }
486 
487     // ------------- associations ------------------
488 
489     private void handleGetOperation1rPreCondition()
490     {
491     }
492 
493     private void handleGetOperation1rPostCondition()
494     {
495     }
496 
497     public final org.andromda.metafacades.uml.OperationFacade getOperation()
498     {
499         org.andromda.metafacades.uml.OperationFacade getOperation1r = null;
500         handleGetOperation1rPreCondition();
501         Object result = this.shieldedElement(handleGetOperation());
502         try
503         {
504             getOperation1r = (org.andromda.metafacades.uml.OperationFacade)result;
505         }
506         catch (ClassCastException ex)
507         {
508             // ignore since the metafacade shouldn't
509             // be set if its not of the correct type
510         }
511         handleGetOperation1rPostCondition();
512         return getOperation1r;
513     }
514 
515     protected abstract java.lang.Object handleGetOperation();
516 
517     private void handleGetEvent2rPreCondition()
518     {
519     }
520 
521     private void handleGetEvent2rPostCondition()
522     {
523     }
524 
525     public final org.andromda.metafacades.uml.EventFacade getEvent()
526     {
527         org.andromda.metafacades.uml.EventFacade getEvent2r = null;
528         handleGetEvent2rPreCondition();
529         Object result = this.shieldedElement(handleGetEvent());
530         try
531         {
532             getEvent2r = (org.andromda.metafacades.uml.EventFacade)result;
533         }
534         catch (ClassCastException ex)
535         {
536             // ignore since the metafacade shouldn't
537             // be set if its not of the correct type
538         }
539         handleGetEvent2rPostCondition();
540         return getEvent2r;
541     }
542 
543     protected abstract java.lang.Object handleGetEvent();
544 
545     private void handleGetType3rPreCondition()
546     {
547     }
548 
549     private void handleGetType3rPostCondition()
550     {
551     }
552 
553     public final org.andromda.metafacades.uml.ClassifierFacade getType()
554     {
555         org.andromda.metafacades.uml.ClassifierFacade getType3r = null;
556         handleGetType3rPreCondition();
557         Object result = this.shieldedElement(handleGetType());
558         try
559         {
560             getType3r = (org.andromda.metafacades.uml.ClassifierFacade)result;
561         }
562         catch (ClassCastException ex)
563         {
564             // ignore since the metafacade shouldn't
565             // be set if its not of the correct type
566         }
567         handleGetType3rPostCondition();
568         return getType3r;
569     }
570 
571     protected abstract java.lang.Object handleGetType();
572 
573     /***
574      * @see org.andromda.core.metafacade.MetafacadeBase#validateInvariants(java.util.Collection)
575      */
576     public void validateInvariants(java.util.Collection validationMessages)
577     {
578         super.validateInvariants(validationMessages);
579         {
580             final java.lang.Object contextElement = this.THIS(); boolean constraintValid = org.andromda.translation.ocl.validation.OCLResultEnsurer.ensure((Boolean.valueOf(String.valueOf(org.andromda.translation.ocl.validation.OCLExpressions.equal(org.andromda.translation.ocl.validation.OCLIntrospector.invoke(contextElement,"return"),false))).booleanValue()?org.andromda.translation.ocl.validation.OCLCollections.notEmpty(org.andromda.translation.ocl.validation.OCLIntrospector.invoke(contextElement,"type")):true)); 
581             if (!constraintValid)
582                 validationMessages.add(
583                     new org.andromda.core.metafacade.ModelValidationMessage(
584                         (org.andromda.core.metafacade.MetafacadeBase)contextElement ,
585                         "org::andromda::metafacades::uml::ParameterFacade::parameter needs a type",
586                         "Each parameter needs a type, you cannot leave the type unspecified."));
587         }
588         {
589             final java.lang.Object contextElement = this.THIS(); boolean constraintValid = org.andromda.translation.ocl.validation.OCLResultEnsurer.ensure((Boolean.valueOf(String.valueOf(org.andromda.translation.ocl.validation.OCLExpressions.equal(org.andromda.translation.ocl.validation.OCLIntrospector.invoke(contextElement,"return"),false))).booleanValue()?org.andromda.translation.ocl.validation.OCLCollections.notEmpty(org.andromda.translation.ocl.validation.OCLIntrospector.invoke(contextElement,"name")):true)); 
590             if (!constraintValid)
591                 validationMessages.add(
592                     new org.andromda.core.metafacade.ModelValidationMessage(
593                         (org.andromda.core.metafacade.MetafacadeBase)contextElement ,
594                         "org::andromda::metafacades::uml::ParameterFacade::non return type parameters must be named",
595                         "Each parameter that is NOT a return parameter must have a non-empty name."));
596         }
597     }
598     
599     /***
600      * The property that stores the name of the metafacade.
601      */
602     private static final String NAME_PROPERTY = "name";
603     
604     /***
605      * @see java.lang.Object#toString()
606      */
607     public String toString()
608     {
609         final StringBuffer toString = new StringBuffer(this.getClass().getName());
610         toString.append("[");
611         try
612         {
613             toString.append(org.andromda.core.common.Introspector.instance().getProperty(this, NAME_PROPERTY));
614         }
615         catch (final Throwable throwable)
616         {
617             // - just ignore when the metafacade doesn't have a name property
618         }
619         toString.append("]");
620         return toString.toString();
621     }
622 }