View Javadoc
1   // license-header java merge-point
2   //
3   // Attention: generated code (by MetafacadeLogic.vsl) - do not modify!
4   //
5   package org.andromda.metafacades.uml14;
6   
7   import java.util.Collection;
8   import org.andromda.core.metafacade.ModelValidationMessage;
9   import org.andromda.metafacades.uml.EnumerationLiteralFacade;
10  import org.omg.uml.foundation.core.EnumerationLiteral;
11  
12  /**
13   * A user-defined data value for an enumeration.
14   * MetafacadeLogic for EnumerationLiteralFacade
15   *
16   * @see EnumerationLiteralFacade
17   */
18  public abstract class EnumerationLiteralFacadeLogic
19      extends ModelElementFacadeLogicImpl
20      implements EnumerationLiteralFacade
21  {
22      /**
23       * The underlying UML object
24       * @see EnumerationLiteral
25       */
26      protected EnumerationLiteral metaObject;
27  
28      /** Create Metafacade implementation instance using the MetafacadeFactory from the context
29       * @param metaObjectIn
30       * @param context
31       */
32      protected EnumerationLiteralFacadeLogic(EnumerationLiteral metaObjectIn, String context)
33      {
34          super(metaObjectIn, getContext(context));
35          this.metaObject = metaObjectIn;
36      }
37  
38      /**
39       * Gets the context for this metafacade logic instance.
40       * @param context String. Set to EnumerationLiteralFacade if null
41       * @return context String
42       */
43      private static String getContext(String context)
44      {
45          if (context == null)
46          {
47              context = "org.andromda.metafacades.uml.EnumerationLiteralFacade";
48          }
49          return context;
50      }
51  
52      /** Reset context only for non-root metafacades
53       * @param context
54       */
55      @Override
56      public void resetMetafacadeContext(String context)
57      {
58          if (!this.contextRoot) // reset context only for non-root metafacades
59          {
60              context = getContext(context);  // to have same value as in original constructor call
61              setMetafacadeContext (context);
62          }
63      }
64  
65      /**
66       * @return boolean true always
67       * @see EnumerationLiteralFacade
68       */
69      public boolean isEnumerationLiteralFacadeMetaType()
70      {
71          return true;
72      }
73  
74      // --------------- attributes ---------------------
75  
76     /**
77      * @see EnumerationLiteralFacade#getValue()
78      * @return String
79      */
80      protected abstract String handleGetValue();
81  
82      private String __value1a;
83      private boolean __value1aSet = false;
84  
85      /**
86       * Returns the value of this enumeration literal, by default the value is the same as the name.
87       * @return (String)handleGetValue()
88       */
89      public final String getValue()
90      {
91          String value1a = this.__value1a;
92          if (!this.__value1aSet)
93          {
94              // value has no pre constraints
95              value1a = handleGetValue();
96              // value has no post constraints
97              this.__value1a = value1a;
98              if (isMetafacadePropertyCachingEnabled())
99              {
100                 this.__value1aSet = true;
101             }
102         }
103         return value1a;
104     }
105 
106     // ---------------- business methods ----------------------
107 
108     /**
109      * Method to be implemented in descendants
110      * Gets the name of the enumeration literal (if the "modelName" flag is true, then the actual
111      * name of the literal in the model is returned - otherwise the name that has any masking
112      * applied).
113      * @param modelName
114      * @return String
115      */
116     protected abstract String handleGetName(boolean modelName);
117 
118     /**
119      * Gets the name of the enumeration literal (if the "modelName" flag is true, then the actual
120      * name of the literal in the model is returned - otherwise the name that has any masking
121      * applied).
122      * @param modelName boolean
123      * TODO: Model Documentation for
124      * EnumerationLiteralFacade.getName(modelName)
125      * @return handleGetName(modelName)
126      */
127     public String getName(boolean modelName)
128     {
129         // getName has no pre constraints
130         String returnValue = handleGetName(modelName);
131         // getName has no post constraints
132         return returnValue;
133     }
134 
135     /**
136      * Method to be implemented in descendants
137      * Gets the value of the enumeration literal  (if the "modelValue" flag is true, then the actual
138      * value of the literal in the model is returned - otherwise the value that has any masking
139      * applied is returned).
140      * @param modelValue
141      * @return String
142      */
143     protected abstract String handleGetValue(boolean modelValue);
144 
145     /**
146      * Gets the value of the enumeration literal  (if the "modelValue" flag is true, then the actual
147      * value of the literal in the model is returned - otherwise the value that has any masking
148      * applied is returned).
149      * @param modelValue boolean
150      * TODO: Model Documentation for
151      * EnumerationLiteralFacade.getValue(modelValue)
152      * @return handleGetValue(modelValue)
153      */
154     public String getValue(boolean modelValue)
155     {
156         // getValue has no pre constraints
157         String returnValue = handleGetValue(modelValue);
158         // getValue has no post constraints
159         return returnValue;
160     }
161 
162     /**
163      * Method to be implemented in descendants
164      * Gets the Literal's Value. This will be used to create the Literal's Instance.
165      * @return String
166      */
167     protected abstract String handleGetEnumerationValue();
168 
169     /**
170      * Gets the Literal's Value. This will be used to create the Literal's Instance.
171      * @return handleGetEnumerationValue()
172      */
173     public String getEnumerationValue()
174     {
175         // getEnumerationValue has no pre constraints
176         String returnValue = handleGetEnumerationValue();
177         // getEnumerationValue has no post constraints
178         return returnValue;
179     }
180 
181     /**
182      * @param validationMessages Collection<ModelValidationMessage>
183      * @see ModelElementFacadeLogicImpl#validateInvariants(Collection validationMessages)
184      */
185     @Override
186     public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
187     {
188         super.validateInvariants(validationMessages);
189     }
190 }