1
2
3
4
5 package org.andromda.metafacades.uml14;
6
7 import java.util.Collection;
8 import org.andromda.core.metafacade.MetafacadeBase;
9 import org.andromda.core.metafacade.ModelValidationMessage;
10 import org.andromda.metafacades.uml.DependencyFacade;
11 import org.andromda.metafacades.uml.ModelElementFacade;
12 import org.apache.log4j.Logger;
13 import org.omg.uml.foundation.core.Dependency;
14
15
16
17
18
19
20
21
22
23 public abstract class DependencyFacadeLogic
24 extends ModelElementFacadeLogicImpl
25 implements DependencyFacade
26 {
27
28
29
30
31 protected Dependency metaObject;
32
33
34
35
36
37 protected DependencyFacadeLogic(Dependency metaObjectIn, String context)
38 {
39 super(metaObjectIn, getContext(context));
40 this.metaObject = metaObjectIn;
41 }
42
43
44
45
46 private static final Logger logger = Logger.getLogger(DependencyFacadeLogic.class);
47
48
49
50
51
52
53 private static String getContext(String context)
54 {
55 if (context == null)
56 {
57 context = "org.andromda.metafacades.uml.DependencyFacade";
58 }
59 return context;
60 }
61
62
63
64
65 @Override
66 public void resetMetafacadeContext(String context)
67 {
68 if (!this.contextRoot)
69 {
70 context = getContext(context);
71 setMetafacadeContext (context);
72 }
73 }
74
75
76
77
78
79 public boolean isDependencyFacadeMetaType()
80 {
81 return true;
82 }
83
84
85
86
87
88
89
90 protected abstract String handleGetGetterName();
91
92 private String __getterName1a;
93 private boolean __getterName1aSet = false;
94
95
96
97
98
99 public final String getGetterName()
100 {
101 String getterName1a = this.__getterName1a;
102 if (!this.__getterName1aSet)
103 {
104
105 getterName1a = handleGetGetterName();
106
107 this.__getterName1a = getterName1a;
108 if (isMetafacadePropertyCachingEnabled())
109 {
110 this.__getterName1aSet = true;
111 }
112 }
113 return getterName1a;
114 }
115
116
117
118
119
120 protected abstract String handleGetSetterName();
121
122 private String __setterName2a;
123 private boolean __setterName2aSet = false;
124
125
126
127
128
129 public final String getSetterName()
130 {
131 String setterName2a = this.__setterName2a;
132 if (!this.__setterName2aSet)
133 {
134
135 setterName2a = handleGetSetterName();
136
137 this.__setterName2a = setterName2a;
138 if (isMetafacadePropertyCachingEnabled())
139 {
140 this.__setterName2aSet = true;
141 }
142 }
143 return setterName2a;
144 }
145
146
147
148
149
150
151
152 public final ModelElementFacade getSourceElement()
153 {
154 ModelElementFacade getSourceElement1r = null;
155
156 Object result = handleGetSourceElement();
157 MetafacadeBase shieldedResult = this.shieldedElement(result);
158 try
159 {
160 getSourceElement1r = (ModelElementFacade)shieldedResult;
161 }
162 catch (ClassCastException ex)
163 {
164
165 DependencyFacadeLogic.logger.warn("incorrect metafacade cast for DependencyFacadeLogic.getSourceElement ModelElementFacade " + result + ": " + shieldedResult);
166 }
167
168 return getSourceElement1r;
169 }
170
171
172
173
174
175 protected abstract Object handleGetSourceElement();
176
177
178
179
180
181 public final ModelElementFacade getTargetElement()
182 {
183 ModelElementFacade getTargetElement2r = null;
184
185 Object result = handleGetTargetElement();
186 MetafacadeBase shieldedResult = this.shieldedElement(result);
187 try
188 {
189 getTargetElement2r = (ModelElementFacade)shieldedResult;
190 }
191 catch (ClassCastException ex)
192 {
193
194 DependencyFacadeLogic.logger.warn("incorrect metafacade cast for DependencyFacadeLogic.getTargetElement ModelElementFacade " + result + ": " + shieldedResult);
195 }
196
197 return getTargetElement2r;
198 }
199
200
201
202
203
204 protected abstract Object handleGetTargetElement();
205
206
207
208
209
210 @Override
211 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
212 {
213 super.validateInvariants(validationMessages);
214 }
215 }