1
2
3
4
5 package org.andromda.metafacades.uml14;
6
7 import java.util.Collection;
8 import java.util.List;
9 import org.andromda.core.metafacade.MetafacadeBase;
10 import org.andromda.core.metafacade.ModelValidationMessage;
11 import org.andromda.metafacades.uml.AttributeFacade;
12 import org.andromda.metafacades.uml.AttributeLinkFacade;
13 import org.andromda.metafacades.uml.InstanceFacade;
14 import org.apache.log4j.Logger;
15 import org.omg.uml.behavioralelements.commonbehavior.AttributeLink;
16
17
18
19
20
21
22
23
24 public abstract class AttributeLinkFacadeLogic
25 extends ModelElementFacadeLogicImpl
26 implements AttributeLinkFacade
27 {
28
29
30
31
32 protected AttributeLink metaObject;
33
34
35
36
37
38 protected AttributeLinkFacadeLogic(AttributeLink metaObjectIn, String context)
39 {
40 super(metaObjectIn, getContext(context));
41 this.metaObject = metaObjectIn;
42 }
43
44
45
46
47 private static final Logger logger = Logger.getLogger(AttributeLinkFacadeLogic.class);
48
49
50
51
52
53
54 private static String getContext(String context)
55 {
56 if (context == null)
57 {
58 context = "org.andromda.metafacades.uml.AttributeLinkFacade";
59 }
60 return context;
61 }
62
63
64
65
66 @Override
67 public void resetMetafacadeContext(String context)
68 {
69 if (!this.contextRoot)
70 {
71 context = getContext(context);
72 setMetafacadeContext (context);
73 }
74 }
75
76
77
78
79
80 public boolean isAttributeLinkFacadeMetaType()
81 {
82 return true;
83 }
84
85
86
87 private Collection<InstanceFacade> __getValues1r;
88 private boolean __getValues1rSet = false;
89
90
91
92
93
94
95
96 public final Collection<InstanceFacade> getValues()
97 {
98 Collection<InstanceFacade> getValues1r = this.__getValues1r;
99 if (!this.__getValues1rSet)
100 {
101
102 Collection result = handleGetValues();
103 List shieldedResult = this.shieldedElements(result);
104 try
105 {
106 getValues1r = (Collection<InstanceFacade>)shieldedResult;
107 }
108 catch (ClassCastException ex)
109 {
110
111 AttributeLinkFacadeLogic.logger.warn("incorrect metafacade cast for AttributeLinkFacadeLogic.getValues Collection<InstanceFacade> " + result + ": " + shieldedResult);
112 }
113
114 this.__getValues1r = getValues1r;
115 if (isMetafacadePropertyCachingEnabled())
116 {
117 this.__getValues1rSet = true;
118 }
119 }
120 return getValues1r;
121 }
122
123
124
125
126
127 protected abstract Collection handleGetValues();
128
129 private InstanceFacade __getInstance2r;
130 private boolean __getInstance2rSet = false;
131
132
133
134
135
136 public final InstanceFacade getInstance()
137 {
138 InstanceFacade getInstance2r = this.__getInstance2r;
139 if (!this.__getInstance2rSet)
140 {
141
142 Object result = handleGetInstance();
143 MetafacadeBase shieldedResult = this.shieldedElement(result);
144 try
145 {
146 getInstance2r = (InstanceFacade)shieldedResult;
147 }
148 catch (ClassCastException ex)
149 {
150
151 AttributeLinkFacadeLogic.logger.warn("incorrect metafacade cast for AttributeLinkFacadeLogic.getInstance InstanceFacade " + result + ": " + shieldedResult);
152 }
153
154 this.__getInstance2r = getInstance2r;
155 if (isMetafacadePropertyCachingEnabled())
156 {
157 this.__getInstance2rSet = true;
158 }
159 }
160 return getInstance2r;
161 }
162
163
164
165
166
167 protected abstract Object handleGetInstance();
168
169 private InstanceFacade __getValue3r;
170 private boolean __getValue3rSet = false;
171
172
173
174
175
176
177
178 public final InstanceFacade getValue()
179 {
180 InstanceFacade getValue3r = this.__getValue3r;
181 if (!this.__getValue3rSet)
182 {
183
184 Object result = handleGetValue();
185 MetafacadeBase shieldedResult = this.shieldedElement(result);
186 try
187 {
188 getValue3r = (InstanceFacade)shieldedResult;
189 }
190 catch (ClassCastException ex)
191 {
192
193 AttributeLinkFacadeLogic.logger.warn("incorrect metafacade cast for AttributeLinkFacadeLogic.getValue InstanceFacade " + result + ": " + shieldedResult);
194 }
195
196 this.__getValue3r = getValue3r;
197 if (isMetafacadePropertyCachingEnabled())
198 {
199 this.__getValue3rSet = true;
200 }
201 }
202 return getValue3r;
203 }
204
205
206
207
208
209 protected abstract Object handleGetValue();
210
211 private AttributeFacade __getAttribute4r;
212 private boolean __getAttribute4rSet = false;
213
214
215
216
217
218
219
220 public final AttributeFacade getAttribute()
221 {
222 AttributeFacade getAttribute4r = this.__getAttribute4r;
223 if (!this.__getAttribute4rSet)
224 {
225
226 Object result = handleGetAttribute();
227 MetafacadeBase shieldedResult = this.shieldedElement(result);
228 try
229 {
230 getAttribute4r = (AttributeFacade)shieldedResult;
231 }
232 catch (ClassCastException ex)
233 {
234
235 AttributeLinkFacadeLogic.logger.warn("incorrect metafacade cast for AttributeLinkFacadeLogic.getAttribute AttributeFacade " + result + ": " + shieldedResult);
236 }
237
238 this.__getAttribute4r = getAttribute4r;
239 if (isMetafacadePropertyCachingEnabled())
240 {
241 this.__getAttribute4rSet = true;
242 }
243 }
244 return getAttribute4r;
245 }
246
247
248
249
250
251 protected abstract Object handleGetAttribute();
252
253
254
255
256
257 @Override
258 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
259 {
260 super.validateInvariants(validationMessages);
261 }
262 }