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 java.util.List;
9 import org.andromda.core.metafacade.ModelValidationMessage;
10 import org.andromda.metafacades.uml.BindingFacade;
11 import org.andromda.metafacades.uml.TemplateArgumentFacade;
12 import org.apache.log4j.Logger;
13 import org.omg.uml.foundation.core.Binding;
14
15 /**
16 * A representation of the model object 'Template Binding'. Represents a relationship between a
17 * templateable element and a template. Specifies the substitutions of actual parameters for the
18 * formal parameters of the template.
19 * MetafacadeLogic for BindingFacade
20 *
21 * @see BindingFacade
22 */
23 public abstract class BindingFacadeLogic
24 extends DependencyFacadeLogicImpl
25 implements BindingFacade
26 {
27 /**
28 * The underlying UML object
29 * @see Binding
30 */
31 protected Binding metaObject;
32
33 /** Create Metafacade implementation instance using the MetafacadeFactory from the context
34 * @param metaObjectIn
35 * @param context
36 */
37 protected BindingFacadeLogic(Binding metaObjectIn, String context)
38 {
39 super(metaObjectIn, getContext(context));
40 this.metaObject = metaObjectIn;
41 }
42
43 /**
44 * The logger instance.
45 */
46 private static final Logger logger = Logger.getLogger(BindingFacadeLogic.class);
47
48 /**
49 * Gets the context for this metafacade logic instance.
50 * @param context String. Set to BindingFacade if null
51 * @return context String
52 */
53 private static String getContext(String context)
54 {
55 if (context == null)
56 {
57 context = "org.andromda.metafacades.uml.BindingFacade";
58 }
59 return context;
60 }
61
62 /** Reset context only for non-root metafacades
63 * @param context
64 */
65 @Override
66 public void resetMetafacadeContext(String context)
67 {
68 if (!this.contextRoot) // reset context only for non-root metafacades
69 {
70 context = getContext(context); // to have same value as in original constructor call
71 setMetafacadeContext (context);
72 }
73 }
74
75 /**
76 * @return boolean true always
77 * @see BindingFacade
78 */
79 public boolean isBindingFacadeMetaType()
80 {
81 return true;
82 }
83
84 // ------------- associations ------------------
85
86 /**
87 * A representation of the model object 'Template Binding'. Represents a relationship between a
88 * templateable element and a template. Specifies the substitutions of actual parameters for the
89 * formal
90 * parameters of the template.
91 * @return (Collection<TemplateArgumentFacade>)handleGetArguments()
92 */
93 public final Collection<TemplateArgumentFacade> getArguments()
94 {
95 Collection<TemplateArgumentFacade> getArguments1r = null;
96 // bindingFacade has no pre constraints
97 Collection result = handleGetArguments();
98 List shieldedResult = this.shieldedElements(result);
99 try
100 {
101 getArguments1r = (Collection<TemplateArgumentFacade>)shieldedResult;
102 }
103 catch (ClassCastException ex)
104 {
105 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
106 BindingFacadeLogic.logger.warn("incorrect metafacade cast for BindingFacadeLogic.getArguments Collection<TemplateArgumentFacade> " + result + ": " + shieldedResult);
107 }
108 // bindingFacade has no post constraints
109 return getArguments1r;
110 }
111
112 /**
113 * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type
114 * @return Collection
115 */
116 protected abstract Collection handleGetArguments();
117
118 /**
119 * @param validationMessages Collection<ModelValidationMessage>
120 * @see DependencyFacadeLogicImpl#validateInvariants(Collection validationMessages)
121 */
122 @Override
123 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
124 {
125 super.validateInvariants(validationMessages);
126 }
127 }