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.EnumerationFacade
8    *
9    * @see org.andromda.metafacades.uml.EnumerationFacade
10   */
11  public abstract class EnumerationFacadeLogic
12      extends org.andromda.metafacades.uml14.ClassifierFacadeLogicImpl
13      implements org.andromda.metafacades.uml.EnumerationFacade
14  {
15  
16      protected Object metaObject;
17  
18      public EnumerationFacadeLogic(Object metaObject, String context)
19      {
20          super((org.omg.uml.foundation.core.Classifier)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.EnumerationFacade";
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.EnumerationFacade
50       */
51      public boolean isEnumerationFacadeMetaType()
52      {
53          return true;
54      }
55      
56      // --------------- attributes ---------------------
57  
58     /***
59      * @see org.andromda.metafacades.uml.EnumerationFacade#getFromOperationSignature()
60      */
61      protected abstract java.lang.String handleGetFromOperationSignature();
62  
63      private void handleGetFromOperationSignature1aPreCondition()
64      {
65      }
66  
67      private void handleGetFromOperationSignature1aPostCondition()
68      {
69      }
70  
71      private java.lang.String __fromOperationSignature1a;
72      private boolean __fromOperationSignature1aSet = false;
73  
74      public final java.lang.String getFromOperationSignature()
75      {
76          java.lang.String fromOperationSignature1a = this.__fromOperationSignature1a;
77          if (!this.__fromOperationSignature1aSet)
78          {
79              handleGetFromOperationSignature1aPreCondition();
80              fromOperationSignature1a = handleGetFromOperationSignature();
81              handleGetFromOperationSignature1aPostCondition();
82              this.__fromOperationSignature1a = fromOperationSignature1a;
83              if (isMetafacadePropertyCachingEnabled())
84              {
85                  this.__fromOperationSignature1aSet = true;
86              }
87          }
88          return fromOperationSignature1a;
89      }
90  
91     /***
92      * @see org.andromda.metafacades.uml.EnumerationFacade#getFromOperationName()
93      */
94      protected abstract java.lang.String handleGetFromOperationName();
95  
96      private void handleGetFromOperationName2aPreCondition()
97      {
98      }
99  
100     private void handleGetFromOperationName2aPostCondition()
101     {
102     }
103 
104     private java.lang.String __fromOperationName2a;
105     private boolean __fromOperationName2aSet = false;
106 
107     public final java.lang.String getFromOperationName()
108     {
109         java.lang.String fromOperationName2a = this.__fromOperationName2a;
110         if (!this.__fromOperationName2aSet)
111         {
112             handleGetFromOperationName2aPreCondition();
113             fromOperationName2a = handleGetFromOperationName();
114             handleGetFromOperationName2aPostCondition();
115             this.__fromOperationName2a = fromOperationName2a;
116             if (isMetafacadePropertyCachingEnabled())
117             {
118                 this.__fromOperationName2aSet = true;
119             }
120         }
121         return fromOperationName2a;
122     }
123 
124    /***
125     * @see org.andromda.metafacades.uml.EnumerationFacade#isTypeSafe()
126     */
127     protected abstract boolean handleIsTypeSafe();
128 
129     private void handleIsTypeSafe3aPreCondition()
130     {
131     }
132 
133     private void handleIsTypeSafe3aPostCondition()
134     {
135     }
136 
137     private boolean __typeSafe3a;
138     private boolean __typeSafe3aSet = false;
139 
140     public final boolean isTypeSafe()
141     {
142         boolean typeSafe3a = this.__typeSafe3a;
143         if (!this.__typeSafe3aSet)
144         {
145             handleIsTypeSafe3aPreCondition();
146             typeSafe3a = handleIsTypeSafe();
147             handleIsTypeSafe3aPostCondition();
148             this.__typeSafe3a = typeSafe3a;
149             if (isMetafacadePropertyCachingEnabled())
150             {
151                 this.__typeSafe3aSet = true;
152             }
153         }
154         return typeSafe3a;
155     }
156 
157     // ------------- associations ------------------
158 
159     private void handleGetLiterals1rPreCondition()
160     {
161     }
162 
163     private void handleGetLiterals1rPostCondition()
164     {
165     }
166 
167     public final java.util.Collection getLiterals()
168     {
169         java.util.Collection getLiterals1r = null;
170         handleGetLiterals1rPreCondition();
171         Object result = this.shieldedElements(handleGetLiterals());
172         try
173         {
174             getLiterals1r = (java.util.Collection)result;
175         }
176         catch (ClassCastException ex)
177         {
178             // ignore since the metafacade shouldn't
179             // be set if its not of the correct type
180         }
181         handleGetLiterals1rPostCondition();
182         return getLiterals1r;
183     }
184 
185     protected abstract java.util.Collection handleGetLiterals();
186 
187     private void handleGetLiteralType2rPreCondition()
188     {
189     }
190 
191     private void handleGetLiteralType2rPostCondition()
192     {
193     }
194 
195     public final org.andromda.metafacades.uml.ClassifierFacade getLiteralType()
196     {
197         org.andromda.metafacades.uml.ClassifierFacade getLiteralType2r = null;
198         handleGetLiteralType2rPreCondition();
199         Object result = this.shieldedElement(handleGetLiteralType());
200         try
201         {
202             getLiteralType2r = (org.andromda.metafacades.uml.ClassifierFacade)result;
203         }
204         catch (ClassCastException ex)
205         {
206             // ignore since the metafacade shouldn't
207             // be set if its not of the correct type
208         }
209         handleGetLiteralType2rPostCondition();
210         return getLiteralType2r;
211     }
212 
213     protected abstract java.lang.Object handleGetLiteralType();
214 
215     private void handleGetMemberVariables3rPreCondition()
216     {
217     }
218 
219     private void handleGetMemberVariables3rPostCondition()
220     {
221     }
222 
223     public final java.util.Collection getMemberVariables()
224     {
225         java.util.Collection getMemberVariables3r = null;
226         handleGetMemberVariables3rPreCondition();
227         Object result = this.shieldedElements(handleGetMemberVariables());
228         try
229         {
230             getMemberVariables3r = (java.util.Collection)result;
231         }
232         catch (ClassCastException ex)
233         {
234             // ignore since the metafacade shouldn't
235             // be set if its not of the correct type
236         }
237         handleGetMemberVariables3rPostCondition();
238         return getMemberVariables3r;
239     }
240 
241     protected abstract java.util.Collection handleGetMemberVariables();
242 
243     /***
244      * @see org.andromda.core.metafacade.MetafacadeBase#validateInvariants(java.util.Collection)
245      */
246     public void validateInvariants(java.util.Collection validationMessages)
247     {
248         super.validateInvariants(validationMessages);
249         {
250             final java.lang.Object contextElement = this.THIS(); boolean constraintValid = org.andromda.translation.ocl.validation.OCLResultEnsurer.ensure(org.andromda.translation.ocl.validation.OCLCollections.notEmpty(org.andromda.translation.ocl.validation.OCLIntrospector.invoke(contextElement,"literals"))); 
251             if (!constraintValid)
252                 validationMessages.add(
253                     new org.andromda.core.metafacade.ModelValidationMessage(
254                         (org.andromda.core.metafacade.MetafacadeBase)contextElement ,
255                         "org::andromda::metafacades::uml::EnumerationFacade::enumerations must have at least one attribute",
256                         "An enumeration must have at least one literal modeled."));
257         }
258     }
259     
260     /***
261      * The property that stores the name of the metafacade.
262      */
263     private static final String NAME_PROPERTY = "name";
264     
265     /***
266      * @see java.lang.Object#toString()
267      */
268     public String toString()
269     {
270         final StringBuffer toString = new StringBuffer(this.getClass().getName());
271         toString.append("[");
272         try
273         {
274             toString.append(org.andromda.core.common.Introspector.instance().getProperty(this, NAME_PROPERTY));
275         }
276         catch (final Throwable throwable)
277         {
278             // - just ignore when the metafacade doesn't have a name property
279         }
280         toString.append("]");
281         return toString.toString();
282     }
283 }