001// license-header java merge-point 002// 003// Attention: generated code (by MetafacadeLogic.vsl) - do not modify! 004// 005package org.andromda.metafacades.uml14; 006 007import java.util.Collection; 008import org.andromda.core.metafacade.ModelValidationMessage; 009import org.andromda.metafacades.uml.EnumerationLiteralFacade; 010import org.omg.uml.foundation.core.EnumerationLiteral; 011 012/** 013 * A user-defined data value for an enumeration. 014 * MetafacadeLogic for EnumerationLiteralFacade 015 * 016 * @see EnumerationLiteralFacade 017 */ 018public abstract class EnumerationLiteralFacadeLogic 019 extends ModelElementFacadeLogicImpl 020 implements EnumerationLiteralFacade 021{ 022 /** 023 * The underlying UML object 024 * @see EnumerationLiteral 025 */ 026 protected EnumerationLiteral metaObject; 027 028 /** Create Metafacade implementation instance using the MetafacadeFactory from the context 029 * @param metaObjectIn 030 * @param context 031 */ 032 protected EnumerationLiteralFacadeLogic(EnumerationLiteral metaObjectIn, String context) 033 { 034 super(metaObjectIn, getContext(context)); 035 this.metaObject = metaObjectIn; 036 } 037 038 /** 039 * Gets the context for this metafacade logic instance. 040 * @param context String. Set to EnumerationLiteralFacade if null 041 * @return context String 042 */ 043 private static String getContext(String context) 044 { 045 if (context == null) 046 { 047 context = "org.andromda.metafacades.uml.EnumerationLiteralFacade"; 048 } 049 return context; 050 } 051 052 /** Reset context only for non-root metafacades 053 * @param context 054 */ 055 @Override 056 public void resetMetafacadeContext(String context) 057 { 058 if (!this.contextRoot) // reset context only for non-root metafacades 059 { 060 context = getContext(context); // to have same value as in original constructor call 061 setMetafacadeContext (context); 062 } 063 } 064 065 /** 066 * @return boolean true always 067 * @see EnumerationLiteralFacade 068 */ 069 public boolean isEnumerationLiteralFacadeMetaType() 070 { 071 return true; 072 } 073 074 // --------------- attributes --------------------- 075 076 /** 077 * @see EnumerationLiteralFacade#getValue() 078 * @return String 079 */ 080 protected abstract String handleGetValue(); 081 082 private String __value1a; 083 private boolean __value1aSet = false; 084 085 /** 086 * Returns the value of this enumeration literal, by default the value is the same as the name. 087 * @return (String)handleGetValue() 088 */ 089 public final String getValue() 090 { 091 String value1a = this.__value1a; 092 if (!this.__value1aSet) 093 { 094 // value has no pre constraints 095 value1a = handleGetValue(); 096 // value has no post constraints 097 this.__value1a = value1a; 098 if (isMetafacadePropertyCachingEnabled()) 099 { 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}