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 java.util.List; 009import org.andromda.core.metafacade.ModelValidationMessage; 010import org.andromda.metafacades.uml.BindingFacade; 011import org.andromda.metafacades.uml.TemplateArgumentFacade; 012import org.apache.log4j.Logger; 013import org.omg.uml.foundation.core.Binding; 014 015/** 016 * A representation of the model object 'Template Binding'. Represents a relationship between a 017 * templateable element and a template. Specifies the substitutions of actual parameters for the 018 * formal parameters of the template. 019 * MetafacadeLogic for BindingFacade 020 * 021 * @see BindingFacade 022 */ 023public abstract class BindingFacadeLogic 024 extends DependencyFacadeLogicImpl 025 implements BindingFacade 026{ 027 /** 028 * The underlying UML object 029 * @see Binding 030 */ 031 protected Binding metaObject; 032 033 /** Create Metafacade implementation instance using the MetafacadeFactory from the context 034 * @param metaObjectIn 035 * @param context 036 */ 037 protected BindingFacadeLogic(Binding metaObjectIn, String context) 038 { 039 super(metaObjectIn, getContext(context)); 040 this.metaObject = metaObjectIn; 041 } 042 043 /** 044 * The logger instance. 045 */ 046 private static final Logger logger = Logger.getLogger(BindingFacadeLogic.class); 047 048 /** 049 * Gets the context for this metafacade logic instance. 050 * @param context String. Set to BindingFacade if null 051 * @return context String 052 */ 053 private static String getContext(String context) 054 { 055 if (context == null) 056 { 057 context = "org.andromda.metafacades.uml.BindingFacade"; 058 } 059 return context; 060 } 061 062 /** Reset context only for non-root metafacades 063 * @param context 064 */ 065 @Override 066 public void resetMetafacadeContext(String context) 067 { 068 if (!this.contextRoot) // reset context only for non-root metafacades 069 { 070 context = getContext(context); // to have same value as in original constructor call 071 setMetafacadeContext (context); 072 } 073 } 074 075 /** 076 * @return boolean true always 077 * @see BindingFacade 078 */ 079 public boolean isBindingFacadeMetaType() 080 { 081 return true; 082 } 083 084 // ------------- associations ------------------ 085 086 /** 087 * A representation of the model object 'Template Binding'. Represents a relationship between a 088 * templateable element and a template. Specifies the substitutions of actual parameters for the 089 * formal 090 * parameters of the template. 091 * @return (Collection<TemplateArgumentFacade>)handleGetArguments() 092 */ 093 public final Collection<TemplateArgumentFacade> getArguments() 094 { 095 Collection<TemplateArgumentFacade> getArguments1r = null; 096 // bindingFacade has no pre constraints 097 Collection result = handleGetArguments(); 098 List shieldedResult = this.shieldedElements(result); 099 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}