1 // license-header java merge-point
2 //
3 // Attention: generated code (by Metafacade.vsl) - do not modify!
4 //
5 package org.andromda.metafacades.uml;
6
7 import java.util.Collection;
8 import org.andromda.core.metafacade.ModelValidationMessage;
9
10 /**
11 * Represents a model element. It may be an Element or NamedElement. A named element is an element
12 * in a model that may have a name. An element is a constituent of a model. As such, it has the
13 * capability of owning other elements.
14 *
15 * Metafacade interface to be used by AndroMDA cartridges.
16 */
17 public interface ModelElementFacade
18 {
19 /**
20 * Indicates the metafacade type (used for metafacade mappings).
21 *
22 * @return boolean always <code>true</code>
23 */
24 public boolean isModelElementFacadeMetaType();
25
26 /**
27 * Provides any required initialization of the metafacade.
28 */
29 void initialize();
30
31 /**
32 * Gets the metafacade that acts as the <code>owner</code> of this metafacade.
33 * (for example: an operation is an owner of its parameters, etc). This is used
34 * by AndroMDA's validation framework to provide more context as to where the
35 * error has occurred.
36 * @return Object the Validation Owner
37 */
38 public Object getValidationOwner();
39
40 /**
41 * Gets the name of the metafacade used within validation messages. This provides
42 * the full name of the metafacade.
43 * @return String the Validation Name
44 */
45 public String getValidationName();
46
47 /**
48 * Performs validation of any invariants found on this model element
49 * and stores the messages within the <code>validationMessages</code>
50 * collection.
51 *
52 * @param validationMessages the collection of messages to which additional
53 * validation messages will be added if invariants are broken.
54 */
55 void validateInvariants(Collection<ModelValidationMessage> validationMessages);
56
57 /**
58 * Copies all tagged values from the given ModelElementFacade to this model element facade.
59 * @param element ModelElementFacade
60 */
61 public void copyTaggedValues(ModelElementFacade element);
62
63 /**
64 * Finds the tagged value with the specified 'tagName'. In case there are more values the first
65 * one found will be returned.
66 * @param tagName String
67 * @return Object
68 */
69 public Object findTaggedValue(String tagName);
70
71 /**
72 * Returns all the values for the tagged value with the specified name. The returned collection
73 * will contains only String instances, or will be empty. Never null.
74 * @param tagName String
75 * @return Collection<Object>
76 */
77 public Collection<Object> findTaggedValues(String tagName);
78
79 /**
80 * Returns the fully qualified name of the model element. The fully qualified name includes
81 * complete package qualified name of the underlying model element. The templates parameter will
82 * be replaced by the correct one given the binding relation of the parameter to this element.
83 * @param bindedElement ModelElementFacade
84 * @return String
85 */
86 public String getBindedFullyQualifiedName(ModelElementFacade bindedElement);
87
88 /**
89 * Gets all constraints belonging to the model element.
90 * @return Collection<ConstraintFacade>
91 */
92 public Collection<ConstraintFacade> getConstraints();
93
94 /**
95 * Returns the constraints of the argument kind that have been placed onto this model. Typical
96 * kinds are "inv", "pre" and "post". Other kinds are possible.
97 * @param kind String
98 * @return Collection<ConstraintFacade>
99 */
100 public Collection<ConstraintFacade> getConstraints(String kind);
101
102 /**
103 * Gets the documentation for the model element, The indent argument is prefixed to each line.
104 * By default this method wraps lines after 64 characters.
105 * This method is equivalent to <code>getDocumentation(indent, 64)</code>.
106 * @param indent String
107 * @return String
108 */
109 public String getDocumentation(String indent);
110
111 /**
112 * This method returns the documentation for this model element, with the lines wrapped after
113 * the specified number of characters, values of less than 1 will indicate no line wrapping is
114 * required. By default paragraphs are returned as HTML.
115 * This method is equivalent to <code>getDocumentation(indent, lineLength, true)</code>.
116 * @param indent String
117 * @param lineLength int
118 * @return String
119 */
120 public String getDocumentation(String indent, int lineLength);
121
122 /**
123 * This method returns the documentation for this model element, with the lines wrapped after
124 * the specified number of characters, values of less than 1 will indicate no line wrapping is
125 * required. HTML style determines if HTML Escaping is applied.
126 * @param indent String
127 * @param lineLength int
128 * @param htmlStyle boolean
129 * @return String
130 */
131 public String getDocumentation(String indent, int lineLength, boolean htmlStyle);
132
133 /**
134 * The fully qualified name of this model element.
135 * @return String
136 */
137 public String getFullyQualifiedName();
138
139 /**
140 * Returns the fully qualified name of the model element. The fully qualified name includes
141 * complete package qualified name of the underlying model element. If modelName is true, then
142 * the original name of the model element (the name contained within the model) will be the name
143 * returned, otherwise a name from a language mapping will be returned.
144 * @param modelName boolean
145 * @return String
146 */
147 public String getFullyQualifiedName(boolean modelName);
148
149 /**
150 * Returns the fully qualified name as a path, the returned value always starts with out a slash
151 * '/'.
152 * @return String
153 */
154 public String getFullyQualifiedNamePath();
155
156 /**
157 * Gets the unique identifier of the underlying model element.
158 * @return String
159 */
160 public String getId();
161
162 /**
163 * UML2: Retrieves the keywords for this element. Used to modify implementation properties which
164 * are not represented by other properties, i.e. native, transient, volatile, synchronized,
165 * (added annotations) override, deprecated. Can also be used to suppress compiler warnings:
166 * (added annotations) unchecked, fallthrough, path, serial, finally, all. Annotations require
167 * JDK5 compiler level.
168 * @return Collection<String>
169 */
170 public Collection<String> getKeywords();
171
172 /**
173 * UML2: Retrieves a localized label for this named element.
174 * @return String
175 */
176 public String getLabel();
177
178 /**
179 * The language mappings that have been set for this model element.
180 * @return TypeMappings
181 */
182 public TypeMappings getLanguageMappings();
183
184 /**
185 * Return the model containing this model element (multiple models may be loaded and processed
186 * at the same time).
187 * @return ModelFacade
188 */
189 public ModelFacade getModel();
190
191 /**
192 * The name of the model element.
193 * @return String
194 */
195 public String getName();
196
197 /**
198 * Gets the package to which this model element belongs.
199 * @return ModelElementFacade
200 */
201 public ModelElementFacade getPackage();
202
203 /**
204 * The name of this model element's package.
205 * @return String
206 */
207 public String getPackageName();
208
209 /**
210 * Gets the package name (optionally providing the ability to retrieve the model name and not
211 * the mapped name).
212 * @param modelName boolean
213 * @return String
214 */
215 public String getPackageName(boolean modelName);
216
217 /**
218 * Returns the package as a path, the returned value always starts with out a slash '/'.
219 * @return String
220 */
221 public String getPackagePath();
222
223 /**
224 * UML2: Returns the value of the 'Qualified Name' attribute. A name which allows the
225 * NamedElement to be identified within a hierarchy of nested Namespaces. It is constructed from
226 * the names of the containing namespaces starting at the root of the hierarchy and ending with
227 * the name of the NamedElement itself.
228 * @return String
229 */
230 public String getQualifiedName();
231
232 /**
233 * Gets the root package for the model element.
234 * @return PackageFacade
235 */
236 public PackageFacade getRootPackage();
237
238 /**
239 * Gets the dependencies for which this model element is the source.
240 * @return Collection<DependencyFacade>
241 */
242 public Collection<DependencyFacade> getSourceDependencies();
243
244 /**
245 * If this model element is the context of an activity graph, this represents that activity
246 * graph.
247 * @return StateMachineFacade
248 */
249 public StateMachineFacade getStateMachineContext();
250
251 /**
252 * The collection of ALL stereotype names for this model element.
253 * @return Collection<String>
254 */
255 public Collection<String> getStereotypeNames();
256
257 /**
258 * Gets all stereotypes for this model element.
259 * @return Collection<StereotypeFacade>
260 */
261 public Collection<StereotypeFacade> getStereotypes();
262
263 /**
264 * Return the TaggedValues associated with this model element, under all stereotypes.
265 * @return Collection<TaggedValueFacade>
266 */
267 public Collection<TaggedValueFacade> getTaggedValues();
268
269 /**
270 * Gets the dependencies for which this model element is the target.
271 * @return Collection<DependencyFacade>
272 */
273 public Collection<DependencyFacade> getTargetDependencies();
274
275 /**
276 * Get the template parameter for this model element having the parameterName
277 * @param parameterName String
278 * @return Object
279 */
280 public Object getTemplateParameter(String parameterName);
281
282 /**
283 * Get the template parameters for this model element
284 * @return Collection<TemplateParameterFacade>
285 */
286 public Collection<TemplateParameterFacade> getTemplateParameters();
287
288 /**
289 * The visibility (i.e. public, private, protected or package) of the model element, will
290 * attempt a lookup for these values in the language mappings (if any).
291 * @return String
292 */
293 public String getVisibility();
294
295 /**
296 * Returns true if the model element has the exact stereotype (meaning no stereotype inheritance
297 * is taken into account when searching for the stereotype), false otherwise.
298 * @param stereotypeName String
299 * @return boolean
300 */
301 public boolean hasExactStereotype(String stereotypeName);
302
303 /**
304 * Does the UML Element contain the named Keyword? Keywords can be separated by space, comma,
305 * pipe, semicolon, or << >>
306 * @param keywordName String
307 * @return boolean
308 */
309 public boolean hasKeyword(String keywordName);
310
311 /**
312 * Returns true if the model element has the specified stereotype. If the stereotype itself
313 * does not match, then a search will be made up the stereotype inheritance hierarchy, and if
314 * one of the stereotype's ancestors has a matching name this method will return true, false
315 * otherwise.
316 * For example, if we have a certain stereotype called <<exception>> and a model element has a
317 * stereotype called <<applicationException>> which extends <<exception>>, when calling this
318 * method with 'stereotypeName' defined as 'exception' the method would return true since
319 * <<applicationException>> inherits from <<exception>>. If you want to check if the model
320 * element has the exact stereotype, then use the method 'hasExactStereotype' instead.
321 * @param stereotypeName String
322 * @return boolean
323 */
324 public boolean hasStereotype(String stereotypeName);
325
326 /**
327 * True if there are target dependencies from this element that are instances of BindingFacade.
328 * Deprecated in UML2: Use TemplateBinding parameters instead of dependencies.
329 * @return boolean
330 */
331 public boolean isBindingDependenciesPresent();
332
333 /**
334 * Indicates if any constraints are present on this model element.
335 * @return boolean
336 */
337 public boolean isConstraintsPresent();
338
339 /**
340 * Indicates if any documentation is present on this model element.
341 * @return boolean
342 */
343 public boolean isDocumentationPresent();
344
345 /**
346 * True if this element name is a reserved word in Java, C#, ANSI or ISO C, C++, JavaScript.
347 * @return boolean
348 */
349 public boolean isReservedWord();
350
351 /**
352 * True is there are template parameters on this model element. For UML2, applies to Class,
353 * Operation, Property, and Parameter.
354 * @return boolean
355 */
356 public boolean isTemplateParametersPresent();
357
358 /**
359 * True if this element name is a valid identifier name in Java, C#, ANSI or ISO C, C++,
360 * JavaScript. Contains no spaces, special characters etc. Constraint always applied on
361 * Enumerations and Interfaces, optionally applies on other model elements.
362 * @return boolean
363 */
364 public boolean isValidIdentifierName();
365
366 /**
367 * Searches for the constraint with the specified 'name' on this model element, and if found
368 * translates it using the specified 'translation' from a translation library discovered by the
369 * framework.
370 * @param name String
371 * @param translation String
372 * @return String
373 */
374 public String translateConstraint(String name, String translation);
375
376 /**
377 * Translates all constraints belonging to this model element with the given 'translation'.
378 * @param translation String
379 * @return String[]
380 */
381 public String[] translateConstraints(String translation);
382
383 /**
384 * Translates the constraints of the specified 'kind' belonging to this model element.
385 * @param kind String
386 * @param translation String
387 * @return String[]
388 */
389 public String[] translateConstraints(String kind, String translation);
390 }